| 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_PROGRAM_BINDING_H_ | 5 #ifndef CC_OUTPUT_PROGRAM_BINDING_H_ |
| 6 #define CC_OUTPUT_PROGRAM_BINDING_H_ | 6 #define CC_OUTPUT_PROGRAM_BINDING_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "cc/output/shader.h" |
| 11 | 12 |
| 12 namespace WebKit { class WebGraphicsContext3D; } | 13 namespace WebKit { class WebGraphicsContext3D; } |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 | 16 |
| 16 class ProgramBindingBase { | 17 class ProgramBindingBase { |
| 17 public: | 18 public: |
| 18 ProgramBindingBase(); | 19 ProgramBindingBase(); |
| 19 ~ProgramBindingBase(); | 20 ~ProgramBindingBase(); |
| 20 | 21 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 42 unsigned fragment_shader_id_; | 43 unsigned fragment_shader_id_; |
| 43 bool initialized_; | 44 bool initialized_; |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 DISALLOW_COPY_AND_ASSIGN(ProgramBindingBase); | 47 DISALLOW_COPY_AND_ASSIGN(ProgramBindingBase); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 template <class VertexShader, class FragmentShader> | 50 template <class VertexShader, class FragmentShader> |
| 50 class ProgramBinding : public ProgramBindingBase { | 51 class ProgramBinding : public ProgramBindingBase { |
| 51 public: | 52 public: |
| 52 explicit ProgramBinding(WebKit::WebGraphicsContext3D* context) { | 53 explicit ProgramBinding(WebKit::WebGraphicsContext3D* context, |
| 53 ProgramBindingBase::Init(context, | 54 TexCoordPrecision precision) { |
| 54 vertex_shader_.GetShaderString(), | 55 ProgramBindingBase::Init( |
| 55 fragment_shader_.GetShaderString()); | 56 context, |
| 57 vertex_shader_.GetShaderString(), |
| 58 fragment_shader_.GetShaderString(precision)); |
| 56 } | 59 } |
| 57 | 60 |
| 58 void Initialize(WebKit::WebGraphicsContext3D* context, | 61 void Initialize(WebKit::WebGraphicsContext3D* context, |
| 59 bool using_bind_uniform) { | 62 bool using_bind_uniform) { |
| 60 DCHECK(context); | 63 DCHECK(context); |
| 61 DCHECK(!initialized_); | 64 DCHECK(!initialized_); |
| 62 | 65 |
| 63 if (IsContextLost(context)) | 66 if (IsContextLost(context)) |
| 64 return; | 67 return; |
| 65 | 68 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 86 private: | 89 private: |
| 87 VertexShader vertex_shader_; | 90 VertexShader vertex_shader_; |
| 88 FragmentShader fragment_shader_; | 91 FragmentShader fragment_shader_; |
| 89 | 92 |
| 90 DISALLOW_COPY_AND_ASSIGN(ProgramBinding); | 93 DISALLOW_COPY_AND_ASSIGN(ProgramBinding); |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 } // namespace cc | 96 } // namespace cc |
| 94 | 97 |
| 95 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ | 98 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ |
| OLD | NEW |