| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_OUTPUT_SHADER_H_ | 5 #ifndef CC_OUTPUT_SHADER_H_ |
| 6 #define CC_OUTPUT_SHADER_H_ | 6 #define CC_OUTPUT_SHADER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "third_party/skia/include/core/SkColorPriv.h" | 12 #include "third_party/skia/include/core/SkColorPriv.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Point; | 15 class Point; |
| 16 class Size; | 16 class Size; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace blink { class WebGraphicsContext3D; } | 19 namespace gpu { |
| 20 namespace gles2 { |
| 21 class GLES2Interface; |
| 22 } |
| 23 } |
| 20 | 24 |
| 21 namespace cc { | 25 namespace cc { |
| 22 | 26 |
| 23 enum TexCoordPrecision { | 27 enum TexCoordPrecision { |
| 24 TexCoordPrecisionNA = 0, | 28 TexCoordPrecisionNA = 0, |
| 25 TexCoordPrecisionMedium = 1, | 29 TexCoordPrecisionMedium = 1, |
| 26 TexCoordPrecisionHigh = 2, | 30 TexCoordPrecisionHigh = 2, |
| 27 NumTexCoordPrecisions = 3 | 31 NumTexCoordPrecisions = 3 |
| 28 }; | 32 }; |
| 29 | 33 |
| 30 enum SamplerType { | 34 enum SamplerType { |
| 31 SamplerTypeNA = 0, | 35 SamplerTypeNA = 0, |
| 32 SamplerType2D = 1, | 36 SamplerType2D = 1, |
| 33 SamplerType2DRect = 2, | 37 SamplerType2DRect = 2, |
| 34 SamplerTypeExternalOES = 3, | 38 SamplerTypeExternalOES = 3, |
| 35 NumSamplerTypes = 4 | 39 NumSamplerTypes = 4 |
| 36 }; | 40 }; |
| 37 | 41 |
| 38 // Note: The highp_threshold_cache must be provided by the caller to make | 42 // Note: The highp_threshold_cache must be provided by the caller to make |
| 39 // the caching multi-thread/context safe in an easy low-overhead manner. | 43 // the caching multi-thread/context safe in an easy low-overhead manner. |
| 40 // The caller must make sure to clear highp_threshold_cache to 0, so it can be | 44 // The caller must make sure to clear highp_threshold_cache to 0, so it can be |
| 41 // reinitialized, if a new or different context is used. | 45 // reinitialized, if a new or different context is used. |
| 42 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired( | 46 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired( |
| 43 blink::WebGraphicsContext3D* context, | 47 gpu::gles2::GLES2Interface* context, |
| 44 int *highp_threshold_cache, | 48 int *highp_threshold_cache, |
| 45 int highp_threshold_min, | 49 int highp_threshold_min, |
| 46 gfx::Point max_coordinate); | 50 gfx::Point max_coordinate); |
| 47 | 51 |
| 48 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired( | 52 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired( |
| 49 blink::WebGraphicsContext3D* context, | 53 gpu::gles2::GLES2Interface* context, |
| 50 int *highp_threshold_cache, | 54 int *highp_threshold_cache, |
| 51 int highp_threshold_min, | 55 int highp_threshold_min, |
| 52 gfx::Size max_size); | 56 gfx::Size max_size); |
| 53 | 57 |
| 54 class VertexShaderPosTex { | 58 class VertexShaderPosTex { |
| 55 public: | 59 public: |
| 56 VertexShaderPosTex(); | 60 VertexShaderPosTex(); |
| 57 | 61 |
| 58 void Init(blink::WebGraphicsContext3D* context, | 62 void Init(gpu::gles2::GLES2Interface* context, |
| 59 unsigned program, | 63 unsigned program, |
| 60 int* base_uniform_index); | 64 int* base_uniform_index); |
| 61 std::string GetShaderString() const; | 65 std::string GetShaderString() const; |
| 62 | 66 |
| 63 int matrix_location() const { return matrix_location_; } | 67 int matrix_location() const { return matrix_location_; } |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 int matrix_location_; | 70 int matrix_location_; |
| 67 | 71 |
| 68 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTex); | 72 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTex); |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 class VertexShaderPosTexYUVStretch { | 75 class VertexShaderPosTexYUVStretch { |
| 72 public: | 76 public: |
| 73 VertexShaderPosTexYUVStretch(); | 77 VertexShaderPosTexYUVStretch(); |
| 74 | 78 |
| 75 void Init(blink::WebGraphicsContext3D* context, | 79 void Init(gpu::gles2::GLES2Interface* context, |
| 76 unsigned program, | 80 unsigned program, |
| 77 int* base_uniform_index); | 81 int* base_uniform_index); |
| 78 std::string GetShaderString() const; | 82 std::string GetShaderString() const; |
| 79 | 83 |
| 80 int matrix_location() const { return matrix_location_; } | 84 int matrix_location() const { return matrix_location_; } |
| 81 int tex_scale_location() const { return tex_scale_location_; } | 85 int tex_scale_location() const { return tex_scale_location_; } |
| 82 | 86 |
| 83 private: | 87 private: |
| 84 int matrix_location_; | 88 int matrix_location_; |
| 85 int tex_scale_location_; | 89 int tex_scale_location_; |
| 86 | 90 |
| 87 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexYUVStretch); | 91 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexYUVStretch); |
| 88 }; | 92 }; |
| 89 | 93 |
| 90 class VertexShaderPos { | 94 class VertexShaderPos { |
| 91 public: | 95 public: |
| 92 VertexShaderPos(); | 96 VertexShaderPos(); |
| 93 | 97 |
| 94 void Init(blink::WebGraphicsContext3D* context, | 98 void Init(gpu::gles2::GLES2Interface* context, |
| 95 unsigned program, | 99 unsigned program, |
| 96 int* base_uniform_index); | 100 int* base_uniform_index); |
| 97 std::string GetShaderString() const; | 101 std::string GetShaderString() const; |
| 98 | 102 |
| 99 int matrix_location() const { return matrix_location_; } | 103 int matrix_location() const { return matrix_location_; } |
| 100 | 104 |
| 101 private: | 105 private: |
| 102 int matrix_location_; | 106 int matrix_location_; |
| 103 | 107 |
| 104 DISALLOW_COPY_AND_ASSIGN(VertexShaderPos); | 108 DISALLOW_COPY_AND_ASSIGN(VertexShaderPos); |
| 105 }; | 109 }; |
| 106 | 110 |
| 107 class VertexShaderPosTexIdentity { | 111 class VertexShaderPosTexIdentity { |
| 108 public: | 112 public: |
| 109 void Init(blink::WebGraphicsContext3D* context, | 113 void Init(gpu::gles2::GLES2Interface* context, |
| 110 unsigned program, | 114 unsigned program, |
| 111 int* base_uniform_index) {} | 115 int* base_uniform_index) {} |
| 112 std::string GetShaderString() const; | 116 std::string GetShaderString() const; |
| 113 }; | 117 }; |
| 114 | 118 |
| 115 class VertexShaderPosTexTransform { | 119 class VertexShaderPosTexTransform { |
| 116 public: | 120 public: |
| 117 VertexShaderPosTexTransform(); | 121 VertexShaderPosTexTransform(); |
| 118 | 122 |
| 119 void Init(blink::WebGraphicsContext3D* context, | 123 void Init(gpu::gles2::GLES2Interface* context, |
| 120 unsigned program, | 124 unsigned program, |
| 121 int* base_uniform_index); | 125 int* base_uniform_index); |
| 122 std::string GetShaderString() const; | 126 std::string GetShaderString() const; |
| 123 | 127 |
| 124 int matrix_location() const { return matrix_location_; } | 128 int matrix_location() const { return matrix_location_; } |
| 125 int tex_transform_location() const { return tex_transform_location_; } | 129 int tex_transform_location() const { return tex_transform_location_; } |
| 126 int vertex_opacity_location() const { return vertex_opacity_location_; } | 130 int vertex_opacity_location() const { return vertex_opacity_location_; } |
| 127 | 131 |
| 128 private: | 132 private: |
| 129 int matrix_location_; | 133 int matrix_location_; |
| 130 int tex_transform_location_; | 134 int tex_transform_location_; |
| 131 int vertex_opacity_location_; | 135 int vertex_opacity_location_; |
| 132 | 136 |
| 133 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexTransform); | 137 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexTransform); |
| 134 }; | 138 }; |
| 135 | 139 |
| 136 class VertexShaderQuad { | 140 class VertexShaderQuad { |
| 137 public: | 141 public: |
| 138 VertexShaderQuad(); | 142 VertexShaderQuad(); |
| 139 | 143 |
| 140 void Init(blink::WebGraphicsContext3D* context, | 144 void Init(gpu::gles2::GLES2Interface* context, |
| 141 unsigned program, | 145 unsigned program, |
| 142 int* base_uniform_index); | 146 int* base_uniform_index); |
| 143 std::string GetShaderString() const; | 147 std::string GetShaderString() const; |
| 144 | 148 |
| 145 int matrix_location() const { return matrix_location_; } | 149 int matrix_location() const { return matrix_location_; } |
| 146 int viewport_location() const { return -1; } | 150 int viewport_location() const { return -1; } |
| 147 int quad_location() const { return quad_location_; } | 151 int quad_location() const { return quad_location_; } |
| 148 int edge_location() const { return -1; } | 152 int edge_location() const { return -1; } |
| 149 | 153 |
| 150 private: | 154 private: |
| 151 int matrix_location_; | 155 int matrix_location_; |
| 152 int quad_location_; | 156 int quad_location_; |
| 153 | 157 |
| 154 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuad); | 158 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuad); |
| 155 }; | 159 }; |
| 156 | 160 |
| 157 class VertexShaderQuadAA { | 161 class VertexShaderQuadAA { |
| 158 public: | 162 public: |
| 159 VertexShaderQuadAA(); | 163 VertexShaderQuadAA(); |
| 160 | 164 |
| 161 void Init(blink::WebGraphicsContext3D* context, | 165 void Init(gpu::gles2::GLES2Interface* context, |
| 162 unsigned program, | 166 unsigned program, |
| 163 int* base_uniform_index); | 167 int* base_uniform_index); |
| 164 std::string GetShaderString() const; | 168 std::string GetShaderString() const; |
| 165 | 169 |
| 166 int matrix_location() const { return matrix_location_; } | 170 int matrix_location() const { return matrix_location_; } |
| 167 int viewport_location() const { return viewport_location_; } | 171 int viewport_location() const { return viewport_location_; } |
| 168 int quad_location() const { return quad_location_; } | 172 int quad_location() const { return quad_location_; } |
| 169 int edge_location() const { return edge_location_; } | 173 int edge_location() const { return edge_location_; } |
| 170 | 174 |
| 171 private: | 175 private: |
| 172 int matrix_location_; | 176 int matrix_location_; |
| 173 int viewport_location_; | 177 int viewport_location_; |
| 174 int quad_location_; | 178 int quad_location_; |
| 175 int edge_location_; | 179 int edge_location_; |
| 176 | 180 |
| 177 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadAA); | 181 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadAA); |
| 178 }; | 182 }; |
| 179 | 183 |
| 180 | 184 |
| 181 class VertexShaderQuadTexTransformAA { | 185 class VertexShaderQuadTexTransformAA { |
| 182 public: | 186 public: |
| 183 VertexShaderQuadTexTransformAA(); | 187 VertexShaderQuadTexTransformAA(); |
| 184 | 188 |
| 185 void Init(blink::WebGraphicsContext3D* context, | 189 void Init(gpu::gles2::GLES2Interface* context, |
| 186 unsigned program, | 190 unsigned program, |
| 187 int* base_uniform_index); | 191 int* base_uniform_index); |
| 188 std::string GetShaderString() const; | 192 std::string GetShaderString() const; |
| 189 | 193 |
| 190 int matrix_location() const { return matrix_location_; } | 194 int matrix_location() const { return matrix_location_; } |
| 191 int viewport_location() const { return viewport_location_; } | 195 int viewport_location() const { return viewport_location_; } |
| 192 int quad_location() const { return quad_location_; } | 196 int quad_location() const { return quad_location_; } |
| 193 int edge_location() const { return edge_location_; } | 197 int edge_location() const { return edge_location_; } |
| 194 int tex_transform_location() const { return tex_transform_location_; } | 198 int tex_transform_location() const { return tex_transform_location_; } |
| 195 | 199 |
| 196 private: | 200 private: |
| 197 int matrix_location_; | 201 int matrix_location_; |
| 198 int viewport_location_; | 202 int viewport_location_; |
| 199 int quad_location_; | 203 int quad_location_; |
| 200 int edge_location_; | 204 int edge_location_; |
| 201 int tex_transform_location_; | 205 int tex_transform_location_; |
| 202 | 206 |
| 203 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTexTransformAA); | 207 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTexTransformAA); |
| 204 }; | 208 }; |
| 205 | 209 |
| 206 class VertexShaderTile { | 210 class VertexShaderTile { |
| 207 public: | 211 public: |
| 208 VertexShaderTile(); | 212 VertexShaderTile(); |
| 209 | 213 |
| 210 void Init(blink::WebGraphicsContext3D* context, | 214 void Init(gpu::gles2::GLES2Interface* context, |
| 211 unsigned program, | 215 unsigned program, |
| 212 int* base_uniform_index); | 216 int* base_uniform_index); |
| 213 std::string GetShaderString() const; | 217 std::string GetShaderString() const; |
| 214 | 218 |
| 215 int matrix_location() const { return matrix_location_; } | 219 int matrix_location() const { return matrix_location_; } |
| 216 int viewport_location() const { return -1; } | 220 int viewport_location() const { return -1; } |
| 217 int quad_location() const { return quad_location_; } | 221 int quad_location() const { return quad_location_; } |
| 218 int edge_location() const { return -1; } | 222 int edge_location() const { return -1; } |
| 219 int vertex_tex_transform_location() const { | 223 int vertex_tex_transform_location() const { |
| 220 return vertex_tex_transform_location_; | 224 return vertex_tex_transform_location_; |
| 221 } | 225 } |
| 222 | 226 |
| 223 private: | 227 private: |
| 224 int matrix_location_; | 228 int matrix_location_; |
| 225 int quad_location_; | 229 int quad_location_; |
| 226 int vertex_tex_transform_location_; | 230 int vertex_tex_transform_location_; |
| 227 | 231 |
| 228 DISALLOW_COPY_AND_ASSIGN(VertexShaderTile); | 232 DISALLOW_COPY_AND_ASSIGN(VertexShaderTile); |
| 229 }; | 233 }; |
| 230 | 234 |
| 231 class VertexShaderTileAA { | 235 class VertexShaderTileAA { |
| 232 public: | 236 public: |
| 233 VertexShaderTileAA(); | 237 VertexShaderTileAA(); |
| 234 | 238 |
| 235 void Init(blink::WebGraphicsContext3D* context, | 239 void Init(gpu::gles2::GLES2Interface* context, |
| 236 unsigned program, | 240 unsigned program, |
| 237 int* base_uniform_index); | 241 int* base_uniform_index); |
| 238 std::string GetShaderString() const; | 242 std::string GetShaderString() const; |
| 239 | 243 |
| 240 int matrix_location() const { return matrix_location_; } | 244 int matrix_location() const { return matrix_location_; } |
| 241 int viewport_location() const { return viewport_location_; } | 245 int viewport_location() const { return viewport_location_; } |
| 242 int quad_location() const { return quad_location_; } | 246 int quad_location() const { return quad_location_; } |
| 243 int edge_location() const { return edge_location_; } | 247 int edge_location() const { return edge_location_; } |
| 244 int vertex_tex_transform_location() const { | 248 int vertex_tex_transform_location() const { |
| 245 return vertex_tex_transform_location_; | 249 return vertex_tex_transform_location_; |
| 246 } | 250 } |
| 247 | 251 |
| 248 private: | 252 private: |
| 249 int matrix_location_; | 253 int matrix_location_; |
| 250 int viewport_location_; | 254 int viewport_location_; |
| 251 int quad_location_; | 255 int quad_location_; |
| 252 int edge_location_; | 256 int edge_location_; |
| 253 int vertex_tex_transform_location_; | 257 int vertex_tex_transform_location_; |
| 254 | 258 |
| 255 DISALLOW_COPY_AND_ASSIGN(VertexShaderTileAA); | 259 DISALLOW_COPY_AND_ASSIGN(VertexShaderTileAA); |
| 256 }; | 260 }; |
| 257 | 261 |
| 258 class VertexShaderVideoTransform { | 262 class VertexShaderVideoTransform { |
| 259 public: | 263 public: |
| 260 VertexShaderVideoTransform(); | 264 VertexShaderVideoTransform(); |
| 261 | 265 |
| 262 void Init(blink::WebGraphicsContext3D* context, | 266 void Init(gpu::gles2::GLES2Interface* context, |
| 263 unsigned program, | 267 unsigned program, |
| 264 int* base_uniform_index); | 268 int* base_uniform_index); |
| 265 std::string GetShaderString() const; | 269 std::string GetShaderString() const; |
| 266 | 270 |
| 267 int matrix_location() const { return matrix_location_; } | 271 int matrix_location() const { return matrix_location_; } |
| 268 int tex_matrix_location() const { return tex_matrix_location_; } | 272 int tex_matrix_location() const { return tex_matrix_location_; } |
| 269 | 273 |
| 270 private: | 274 private: |
| 271 int matrix_location_; | 275 int matrix_location_; |
| 272 int tex_matrix_location_; | 276 int tex_matrix_location_; |
| 273 | 277 |
| 274 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); | 278 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); |
| 275 }; | 279 }; |
| 276 | 280 |
| 277 class FragmentTexAlphaBinding { | 281 class FragmentTexAlphaBinding { |
| 278 public: | 282 public: |
| 279 FragmentTexAlphaBinding(); | 283 FragmentTexAlphaBinding(); |
| 280 | 284 |
| 281 void Init(blink::WebGraphicsContext3D* context, | 285 void Init(gpu::gles2::GLES2Interface* context, |
| 282 unsigned program, | 286 unsigned program, |
| 283 int* base_uniform_index); | 287 int* base_uniform_index); |
| 284 int alpha_location() const { return alpha_location_; } | 288 int alpha_location() const { return alpha_location_; } |
| 285 int fragment_tex_transform_location() const { return -1; } | 289 int fragment_tex_transform_location() const { return -1; } |
| 286 int sampler_location() const { return sampler_location_; } | 290 int sampler_location() const { return sampler_location_; } |
| 287 | 291 |
| 288 private: | 292 private: |
| 289 int sampler_location_; | 293 int sampler_location_; |
| 290 int alpha_location_; | 294 int alpha_location_; |
| 291 | 295 |
| 292 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding); | 296 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding); |
| 293 }; | 297 }; |
| 294 | 298 |
| 295 class FragmentTexColorMatrixAlphaBinding { | 299 class FragmentTexColorMatrixAlphaBinding { |
| 296 public: | 300 public: |
| 297 FragmentTexColorMatrixAlphaBinding(); | 301 FragmentTexColorMatrixAlphaBinding(); |
| 298 | 302 |
| 299 void Init(blink::WebGraphicsContext3D* context, | 303 void Init(gpu::gles2::GLES2Interface* context, |
| 300 unsigned program, | 304 unsigned program, |
| 301 int* base_uniform_index); | 305 int* base_uniform_index); |
| 302 int alpha_location() const { return alpha_location_; } | 306 int alpha_location() const { return alpha_location_; } |
| 303 int color_matrix_location() const { return color_matrix_location_; } | 307 int color_matrix_location() const { return color_matrix_location_; } |
| 304 int color_offset_location() const { return color_offset_location_; } | 308 int color_offset_location() const { return color_offset_location_; } |
| 305 int fragment_tex_transform_location() const { return -1; } | 309 int fragment_tex_transform_location() const { return -1; } |
| 306 int sampler_location() const { return sampler_location_; } | 310 int sampler_location() const { return sampler_location_; } |
| 307 | 311 |
| 308 private: | 312 private: |
| 309 int sampler_location_; | 313 int sampler_location_; |
| 310 int alpha_location_; | 314 int alpha_location_; |
| 311 int color_matrix_location_; | 315 int color_matrix_location_; |
| 312 int color_offset_location_; | 316 int color_offset_location_; |
| 313 }; | 317 }; |
| 314 | 318 |
| 315 class FragmentTexOpaqueBinding { | 319 class FragmentTexOpaqueBinding { |
| 316 public: | 320 public: |
| 317 FragmentTexOpaqueBinding(); | 321 FragmentTexOpaqueBinding(); |
| 318 | 322 |
| 319 void Init(blink::WebGraphicsContext3D* context, | 323 void Init(gpu::gles2::GLES2Interface* context, |
| 320 unsigned program, | 324 unsigned program, |
| 321 int* base_uniform_index); | 325 int* base_uniform_index); |
| 322 int alpha_location() const { return -1; } | 326 int alpha_location() const { return -1; } |
| 323 int fragment_tex_transform_location() const { return -1; } | 327 int fragment_tex_transform_location() const { return -1; } |
| 324 int background_color_location() const { return -1; } | 328 int background_color_location() const { return -1; } |
| 325 int sampler_location() const { return sampler_location_; } | 329 int sampler_location() const { return sampler_location_; } |
| 326 | 330 |
| 327 private: | 331 private: |
| 328 int sampler_location_; | 332 int sampler_location_; |
| 329 | 333 |
| 330 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding); | 334 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding); |
| 331 }; | 335 }; |
| 332 | 336 |
| 333 class FragmentTexBackgroundBinding { | 337 class FragmentTexBackgroundBinding { |
| 334 public: | 338 public: |
| 335 FragmentTexBackgroundBinding(); | 339 FragmentTexBackgroundBinding(); |
| 336 | 340 |
| 337 void Init(blink::WebGraphicsContext3D* context, | 341 void Init(gpu::gles2::GLES2Interface* context, |
| 338 unsigned program, | 342 unsigned program, |
| 339 int* base_uniform_index); | 343 int* base_uniform_index); |
| 340 int background_color_location() const { return background_color_location_; } | 344 int background_color_location() const { return background_color_location_; } |
| 341 int sampler_location() const { return sampler_location_; } | 345 int sampler_location() const { return sampler_location_; } |
| 342 | 346 |
| 343 private: | 347 private: |
| 344 int background_color_location_; | 348 int background_color_location_; |
| 345 int sampler_location_; | 349 int sampler_location_; |
| 346 | 350 |
| 347 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding); | 351 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { | 413 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { |
| 410 public: | 414 public: |
| 411 std::string GetShaderString( | 415 std::string GetShaderString( |
| 412 TexCoordPrecision precision, SamplerType sampler) const; | 416 TexCoordPrecision precision, SamplerType sampler) const; |
| 413 }; | 417 }; |
| 414 | 418 |
| 415 class FragmentShaderRGBATexAlphaAA { | 419 class FragmentShaderRGBATexAlphaAA { |
| 416 public: | 420 public: |
| 417 FragmentShaderRGBATexAlphaAA(); | 421 FragmentShaderRGBATexAlphaAA(); |
| 418 | 422 |
| 419 void Init(blink::WebGraphicsContext3D* context, | 423 void Init(gpu::gles2::GLES2Interface* context, |
| 420 unsigned program, | 424 unsigned program, |
| 421 int* base_uniform_index); | 425 int* base_uniform_index); |
| 422 std::string GetShaderString( | 426 std::string GetShaderString( |
| 423 TexCoordPrecision precision, SamplerType sampler) const; | 427 TexCoordPrecision precision, SamplerType sampler) const; |
| 424 | 428 |
| 425 int alpha_location() const { return alpha_location_; } | 429 int alpha_location() const { return alpha_location_; } |
| 426 int sampler_location() const { return sampler_location_; } | 430 int sampler_location() const { return sampler_location_; } |
| 427 | 431 |
| 428 private: | 432 private: |
| 429 int sampler_location_; | 433 int sampler_location_; |
| 430 int alpha_location_; | 434 int alpha_location_; |
| 431 | 435 |
| 432 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA); | 436 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA); |
| 433 }; | 437 }; |
| 434 | 438 |
| 435 class FragmentTexClampAlphaAABinding { | 439 class FragmentTexClampAlphaAABinding { |
| 436 public: | 440 public: |
| 437 FragmentTexClampAlphaAABinding(); | 441 FragmentTexClampAlphaAABinding(); |
| 438 | 442 |
| 439 void Init(blink::WebGraphicsContext3D* context, | 443 void Init(gpu::gles2::GLES2Interface* context, |
| 440 unsigned program, | 444 unsigned program, |
| 441 int* base_uniform_index); | 445 int* base_uniform_index); |
| 442 int alpha_location() const { return alpha_location_; } | 446 int alpha_location() const { return alpha_location_; } |
| 443 int sampler_location() const { return sampler_location_; } | 447 int sampler_location() const { return sampler_location_; } |
| 444 int fragment_tex_transform_location() const { | 448 int fragment_tex_transform_location() const { |
| 445 return fragment_tex_transform_location_; | 449 return fragment_tex_transform_location_; |
| 446 } | 450 } |
| 447 | 451 |
| 448 private: | 452 private: |
| 449 int sampler_location_; | 453 int sampler_location_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 467 std::string GetShaderString( | 471 std::string GetShaderString( |
| 468 TexCoordPrecision precision, SamplerType sampler) const; | 472 TexCoordPrecision precision, SamplerType sampler) const; |
| 469 }; | 473 }; |
| 470 | 474 |
| 471 class FragmentShaderRGBATexAlphaMask { | 475 class FragmentShaderRGBATexAlphaMask { |
| 472 public: | 476 public: |
| 473 FragmentShaderRGBATexAlphaMask(); | 477 FragmentShaderRGBATexAlphaMask(); |
| 474 std::string GetShaderString( | 478 std::string GetShaderString( |
| 475 TexCoordPrecision precision, SamplerType sampler) const; | 479 TexCoordPrecision precision, SamplerType sampler) const; |
| 476 | 480 |
| 477 void Init(blink::WebGraphicsContext3D* context, | 481 void Init(gpu::gles2::GLES2Interface* context, |
| 478 unsigned program, | 482 unsigned program, |
| 479 int* base_uniform_index); | 483 int* base_uniform_index); |
| 480 int alpha_location() const { return alpha_location_; } | 484 int alpha_location() const { return alpha_location_; } |
| 481 int sampler_location() const { return sampler_location_; } | 485 int sampler_location() const { return sampler_location_; } |
| 482 int mask_sampler_location() const { return mask_sampler_location_; } | 486 int mask_sampler_location() const { return mask_sampler_location_; } |
| 483 int mask_tex_coord_scale_location() const { | 487 int mask_tex_coord_scale_location() const { |
| 484 return mask_tex_coord_scale_location_; | 488 return mask_tex_coord_scale_location_; |
| 485 } | 489 } |
| 486 int mask_tex_coord_offset_location() const { | 490 int mask_tex_coord_offset_location() const { |
| 487 return mask_tex_coord_offset_location_; | 491 return mask_tex_coord_offset_location_; |
| 488 } | 492 } |
| 489 | 493 |
| 490 private: | 494 private: |
| 491 int sampler_location_; | 495 int sampler_location_; |
| 492 int mask_sampler_location_; | 496 int mask_sampler_location_; |
| 493 int alpha_location_; | 497 int alpha_location_; |
| 494 int mask_tex_coord_scale_location_; | 498 int mask_tex_coord_scale_location_; |
| 495 int mask_tex_coord_offset_location_; | 499 int mask_tex_coord_offset_location_; |
| 496 | 500 |
| 497 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); | 501 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); |
| 498 }; | 502 }; |
| 499 | 503 |
| 500 class FragmentShaderRGBATexAlphaMaskAA { | 504 class FragmentShaderRGBATexAlphaMaskAA { |
| 501 public: | 505 public: |
| 502 FragmentShaderRGBATexAlphaMaskAA(); | 506 FragmentShaderRGBATexAlphaMaskAA(); |
| 503 std::string GetShaderString( | 507 std::string GetShaderString( |
| 504 TexCoordPrecision precision, SamplerType sampler) const; | 508 TexCoordPrecision precision, SamplerType sampler) const; |
| 505 | 509 |
| 506 void Init(blink::WebGraphicsContext3D* context, | 510 void Init(gpu::gles2::GLES2Interface* context, |
| 507 unsigned program, | 511 unsigned program, |
| 508 int* base_uniform_index); | 512 int* base_uniform_index); |
| 509 int alpha_location() const { return alpha_location_; } | 513 int alpha_location() const { return alpha_location_; } |
| 510 int sampler_location() const { return sampler_location_; } | 514 int sampler_location() const { return sampler_location_; } |
| 511 int mask_sampler_location() const { return mask_sampler_location_; } | 515 int mask_sampler_location() const { return mask_sampler_location_; } |
| 512 int mask_tex_coord_scale_location() const { | 516 int mask_tex_coord_scale_location() const { |
| 513 return mask_tex_coord_scale_location_; | 517 return mask_tex_coord_scale_location_; |
| 514 } | 518 } |
| 515 int mask_tex_coord_offset_location() const { | 519 int mask_tex_coord_offset_location() const { |
| 516 return mask_tex_coord_offset_location_; | 520 return mask_tex_coord_offset_location_; |
| 517 } | 521 } |
| 518 | 522 |
| 519 private: | 523 private: |
| 520 int sampler_location_; | 524 int sampler_location_; |
| 521 int mask_sampler_location_; | 525 int mask_sampler_location_; |
| 522 int alpha_location_; | 526 int alpha_location_; |
| 523 int mask_tex_coord_scale_location_; | 527 int mask_tex_coord_scale_location_; |
| 524 int mask_tex_coord_offset_location_; | 528 int mask_tex_coord_offset_location_; |
| 525 | 529 |
| 526 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); | 530 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); |
| 527 }; | 531 }; |
| 528 | 532 |
| 529 class FragmentShaderRGBATexAlphaMaskColorMatrixAA { | 533 class FragmentShaderRGBATexAlphaMaskColorMatrixAA { |
| 530 public: | 534 public: |
| 531 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); | 535 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); |
| 532 std::string GetShaderString( | 536 std::string GetShaderString( |
| 533 TexCoordPrecision precision, SamplerType sampler) const; | 537 TexCoordPrecision precision, SamplerType sampler) const; |
| 534 | 538 |
| 535 void Init(blink::WebGraphicsContext3D* context, | 539 void Init(gpu::gles2::GLES2Interface* context, |
| 536 unsigned program, | 540 unsigned program, |
| 537 int* base_uniform_index); | 541 int* base_uniform_index); |
| 538 int alpha_location() const { return alpha_location_; } | 542 int alpha_location() const { return alpha_location_; } |
| 539 int sampler_location() const { return sampler_location_; } | 543 int sampler_location() const { return sampler_location_; } |
| 540 int mask_sampler_location() const { return mask_sampler_location_; } | 544 int mask_sampler_location() const { return mask_sampler_location_; } |
| 541 int mask_tex_coord_scale_location() const { | 545 int mask_tex_coord_scale_location() const { |
| 542 return mask_tex_coord_scale_location_; | 546 return mask_tex_coord_scale_location_; |
| 543 } | 547 } |
| 544 int mask_tex_coord_offset_location() const { | 548 int mask_tex_coord_offset_location() const { |
| 545 return mask_tex_coord_offset_location_; | 549 return mask_tex_coord_offset_location_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 556 int color_matrix_location_; | 560 int color_matrix_location_; |
| 557 int color_offset_location_; | 561 int color_offset_location_; |
| 558 }; | 562 }; |
| 559 | 563 |
| 560 class FragmentShaderRGBATexAlphaColorMatrixAA { | 564 class FragmentShaderRGBATexAlphaColorMatrixAA { |
| 561 public: | 565 public: |
| 562 FragmentShaderRGBATexAlphaColorMatrixAA(); | 566 FragmentShaderRGBATexAlphaColorMatrixAA(); |
| 563 std::string GetShaderString( | 567 std::string GetShaderString( |
| 564 TexCoordPrecision precision, SamplerType sampler) const; | 568 TexCoordPrecision precision, SamplerType sampler) const; |
| 565 | 569 |
| 566 void Init(blink::WebGraphicsContext3D* context, | 570 void Init(gpu::gles2::GLES2Interface* context, |
| 567 unsigned program, | 571 unsigned program, |
| 568 int* base_uniform_index); | 572 int* base_uniform_index); |
| 569 int alpha_location() const { return alpha_location_; } | 573 int alpha_location() const { return alpha_location_; } |
| 570 int sampler_location() const { return sampler_location_; } | 574 int sampler_location() const { return sampler_location_; } |
| 571 int color_matrix_location() const { return color_matrix_location_; } | 575 int color_matrix_location() const { return color_matrix_location_; } |
| 572 int color_offset_location() const { return color_offset_location_; } | 576 int color_offset_location() const { return color_offset_location_; } |
| 573 | 577 |
| 574 private: | 578 private: |
| 575 int sampler_location_; | 579 int sampler_location_; |
| 576 int alpha_location_; | 580 int alpha_location_; |
| 577 int color_matrix_location_; | 581 int color_matrix_location_; |
| 578 int color_offset_location_; | 582 int color_offset_location_; |
| 579 }; | 583 }; |
| 580 | 584 |
| 581 class FragmentShaderRGBATexAlphaMaskColorMatrix { | 585 class FragmentShaderRGBATexAlphaMaskColorMatrix { |
| 582 public: | 586 public: |
| 583 FragmentShaderRGBATexAlphaMaskColorMatrix(); | 587 FragmentShaderRGBATexAlphaMaskColorMatrix(); |
| 584 std::string GetShaderString( | 588 std::string GetShaderString( |
| 585 TexCoordPrecision precision, SamplerType sampler) const; | 589 TexCoordPrecision precision, SamplerType sampler) const; |
| 586 | 590 |
| 587 void Init(blink::WebGraphicsContext3D* context, | 591 void Init(gpu::gles2::GLES2Interface* context, |
| 588 unsigned program, | 592 unsigned program, |
| 589 int* base_uniform_index); | 593 int* base_uniform_index); |
| 590 int alpha_location() const { return alpha_location_; } | 594 int alpha_location() const { return alpha_location_; } |
| 591 int sampler_location() const { return sampler_location_; } | 595 int sampler_location() const { return sampler_location_; } |
| 592 int mask_sampler_location() const { return mask_sampler_location_; } | 596 int mask_sampler_location() const { return mask_sampler_location_; } |
| 593 int mask_tex_coord_scale_location() const { | 597 int mask_tex_coord_scale_location() const { |
| 594 return mask_tex_coord_scale_location_; | 598 return mask_tex_coord_scale_location_; |
| 595 } | 599 } |
| 596 int mask_tex_coord_offset_location() const { | 600 int mask_tex_coord_offset_location() const { |
| 597 return mask_tex_coord_offset_location_; | 601 return mask_tex_coord_offset_location_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 608 int color_matrix_location_; | 612 int color_matrix_location_; |
| 609 int color_offset_location_; | 613 int color_offset_location_; |
| 610 }; | 614 }; |
| 611 | 615 |
| 612 class FragmentShaderYUVVideo { | 616 class FragmentShaderYUVVideo { |
| 613 public: | 617 public: |
| 614 FragmentShaderYUVVideo(); | 618 FragmentShaderYUVVideo(); |
| 615 std::string GetShaderString( | 619 std::string GetShaderString( |
| 616 TexCoordPrecision precision, SamplerType sampler) const; | 620 TexCoordPrecision precision, SamplerType sampler) const; |
| 617 | 621 |
| 618 void Init(blink::WebGraphicsContext3D* context, | 622 void Init(gpu::gles2::GLES2Interface* context, |
| 619 unsigned program, | 623 unsigned program, |
| 620 int* base_uniform_index); | 624 int* base_uniform_index); |
| 621 int y_texture_location() const { return y_texture_location_; } | 625 int y_texture_location() const { return y_texture_location_; } |
| 622 int u_texture_location() const { return u_texture_location_; } | 626 int u_texture_location() const { return u_texture_location_; } |
| 623 int v_texture_location() const { return v_texture_location_; } | 627 int v_texture_location() const { return v_texture_location_; } |
| 624 int alpha_location() const { return alpha_location_; } | 628 int alpha_location() const { return alpha_location_; } |
| 625 int yuv_matrix_location() const { return yuv_matrix_location_; } | 629 int yuv_matrix_location() const { return yuv_matrix_location_; } |
| 626 int yuv_adj_location() const { return yuv_adj_location_; } | 630 int yuv_adj_location() const { return yuv_adj_location_; } |
| 627 | 631 |
| 628 private: | 632 private: |
| 629 int y_texture_location_; | 633 int y_texture_location_; |
| 630 int u_texture_location_; | 634 int u_texture_location_; |
| 631 int v_texture_location_; | 635 int v_texture_location_; |
| 632 int alpha_location_; | 636 int alpha_location_; |
| 633 int yuv_matrix_location_; | 637 int yuv_matrix_location_; |
| 634 int yuv_adj_location_; | 638 int yuv_adj_location_; |
| 635 | 639 |
| 636 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); | 640 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); |
| 637 }; | 641 }; |
| 638 | 642 |
| 639 | 643 |
| 640 class FragmentShaderYUVAVideo { | 644 class FragmentShaderYUVAVideo { |
| 641 public: | 645 public: |
| 642 FragmentShaderYUVAVideo(); | 646 FragmentShaderYUVAVideo(); |
| 643 std::string GetShaderString( | 647 std::string GetShaderString( |
| 644 TexCoordPrecision precision, SamplerType sampler) const; | 648 TexCoordPrecision precision, SamplerType sampler) const; |
| 645 | 649 |
| 646 void Init(blink::WebGraphicsContext3D* context, | 650 void Init(gpu::gles2::GLES2Interface* context, |
| 647 unsigned program, | 651 unsigned program, |
| 648 int* base_uniform_index); | 652 int* base_uniform_index); |
| 649 | 653 |
| 650 int y_texture_location() const { return y_texture_location_; } | 654 int y_texture_location() const { return y_texture_location_; } |
| 651 int u_texture_location() const { return u_texture_location_; } | 655 int u_texture_location() const { return u_texture_location_; } |
| 652 int v_texture_location() const { return v_texture_location_; } | 656 int v_texture_location() const { return v_texture_location_; } |
| 653 int a_texture_location() const { return a_texture_location_; } | 657 int a_texture_location() const { return a_texture_location_; } |
| 654 int alpha_location() const { return alpha_location_; } | 658 int alpha_location() const { return alpha_location_; } |
| 655 int yuv_matrix_location() const { return yuv_matrix_location_; } | 659 int yuv_matrix_location() const { return yuv_matrix_location_; } |
| 656 int yuv_adj_location() const { return yuv_adj_location_; } | 660 int yuv_adj_location() const { return yuv_adj_location_; } |
| 657 | 661 |
| 658 private: | 662 private: |
| 659 int y_texture_location_; | 663 int y_texture_location_; |
| 660 int u_texture_location_; | 664 int u_texture_location_; |
| 661 int v_texture_location_; | 665 int v_texture_location_; |
| 662 int a_texture_location_; | 666 int a_texture_location_; |
| 663 int alpha_location_; | 667 int alpha_location_; |
| 664 int yuv_matrix_location_; | 668 int yuv_matrix_location_; |
| 665 int yuv_adj_location_; | 669 int yuv_adj_location_; |
| 666 | 670 |
| 667 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); | 671 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); |
| 668 }; | 672 }; |
| 669 | 673 |
| 670 class FragmentShaderColor { | 674 class FragmentShaderColor { |
| 671 public: | 675 public: |
| 672 FragmentShaderColor(); | 676 FragmentShaderColor(); |
| 673 std::string GetShaderString( | 677 std::string GetShaderString( |
| 674 TexCoordPrecision precision, SamplerType sampler) const; | 678 TexCoordPrecision precision, SamplerType sampler) const; |
| 675 | 679 |
| 676 void Init(blink::WebGraphicsContext3D* context, | 680 void Init(gpu::gles2::GLES2Interface* context, |
| 677 unsigned program, | 681 unsigned program, |
| 678 int* base_uniform_index); | 682 int* base_uniform_index); |
| 679 int color_location() const { return color_location_; } | 683 int color_location() const { return color_location_; } |
| 680 | 684 |
| 681 private: | 685 private: |
| 682 int color_location_; | 686 int color_location_; |
| 683 | 687 |
| 684 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); | 688 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); |
| 685 }; | 689 }; |
| 686 | 690 |
| 687 class FragmentShaderColorAA { | 691 class FragmentShaderColorAA { |
| 688 public: | 692 public: |
| 689 FragmentShaderColorAA(); | 693 FragmentShaderColorAA(); |
| 690 std::string GetShaderString( | 694 std::string GetShaderString( |
| 691 TexCoordPrecision precision, SamplerType sampler) const; | 695 TexCoordPrecision precision, SamplerType sampler) const; |
| 692 | 696 |
| 693 void Init(blink::WebGraphicsContext3D* context, | 697 void Init(gpu::gles2::GLES2Interface* context, |
| 694 unsigned program, | 698 unsigned program, |
| 695 int* base_uniform_index); | 699 int* base_uniform_index); |
| 696 int color_location() const { return color_location_; } | 700 int color_location() const { return color_location_; } |
| 697 | 701 |
| 698 private: | 702 private: |
| 699 int color_location_; | 703 int color_location_; |
| 700 | 704 |
| 701 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); | 705 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); |
| 702 }; | 706 }; |
| 703 | 707 |
| 704 class FragmentShaderCheckerboard { | 708 class FragmentShaderCheckerboard { |
| 705 public: | 709 public: |
| 706 FragmentShaderCheckerboard(); | 710 FragmentShaderCheckerboard(); |
| 707 std::string GetShaderString( | 711 std::string GetShaderString( |
| 708 TexCoordPrecision precision, SamplerType sampler) const; | 712 TexCoordPrecision precision, SamplerType sampler) const; |
| 709 | 713 |
| 710 void Init(blink::WebGraphicsContext3D* context, | 714 void Init(gpu::gles2::GLES2Interface* context, |
| 711 unsigned program, | 715 unsigned program, |
| 712 int* base_uniform_index); | 716 int* base_uniform_index); |
| 713 int alpha_location() const { return alpha_location_; } | 717 int alpha_location() const { return alpha_location_; } |
| 714 int tex_transform_location() const { return tex_transform_location_; } | 718 int tex_transform_location() const { return tex_transform_location_; } |
| 715 int frequency_location() const { return frequency_location_; } | 719 int frequency_location() const { return frequency_location_; } |
| 716 int color_location() const { return color_location_; } | 720 int color_location() const { return color_location_; } |
| 717 | 721 |
| 718 private: | 722 private: |
| 719 int alpha_location_; | 723 int alpha_location_; |
| 720 int tex_transform_location_; | 724 int tex_transform_location_; |
| 721 int frequency_location_; | 725 int frequency_location_; |
| 722 int color_location_; | 726 int color_location_; |
| 723 | 727 |
| 724 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); | 728 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); |
| 725 }; | 729 }; |
| 726 | 730 |
| 727 } // namespace cc | 731 } // namespace cc |
| 728 | 732 |
| 729 #endif // CC_OUTPUT_SHADER_H_ | 733 #endif // CC_OUTPUT_SHADER_H_ |
| OLD | NEW |