| 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 18 matching lines...) Expand all Loading... |
| 39 | 40 |
| 40 unsigned program_; | 41 unsigned program_; |
| 41 unsigned vertex_shader_id_; | 42 unsigned vertex_shader_id_; |
| 42 unsigned fragment_shader_id_; | 43 unsigned fragment_shader_id_; |
| 43 bool initialized_; | 44 bool initialized_; |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 template <class VertexShader, class FragmentShader> | 47 template <class VertexShader, class FragmentShader> |
| 47 class ProgramBinding : public ProgramBindingBase { | 48 class ProgramBinding : public ProgramBindingBase { |
| 48 public: | 49 public: |
| 49 explicit ProgramBinding(WebKit::WebGraphicsContext3D* context) { | 50 explicit ProgramBinding(WebKit::WebGraphicsContext3D* context, |
| 50 ProgramBindingBase::Init(context, | 51 TexCoordPrecision precision) { |
| 51 vertex_shader_.getShaderString(), | 52 ProgramBindingBase::Init( |
| 52 fragment_shader_.getShaderString()); | 53 context, |
| 54 vertex_shader_.getShaderString(context), |
| 55 fragment_shader_.getShaderString(context, precision)); |
| 53 } | 56 } |
| 54 | 57 |
| 55 void Initialize(WebKit::WebGraphicsContext3D* context, | 58 void Initialize(WebKit::WebGraphicsContext3D* context, |
| 56 bool using_bind_uniform) { | 59 bool using_bind_uniform) { |
| 57 DCHECK(context); | 60 DCHECK(context); |
| 58 DCHECK(!initialized_); | 61 DCHECK(!initialized_); |
| 59 | 62 |
| 60 if (IsContextLost(context)) | 63 if (IsContextLost(context)) |
| 61 return; | 64 return; |
| 62 | 65 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 81 const FragmentShader& fragment_shader() const { return fragment_shader_; } | 84 const FragmentShader& fragment_shader() const { return fragment_shader_; } |
| 82 | 85 |
| 83 private: | 86 private: |
| 84 VertexShader vertex_shader_; | 87 VertexShader vertex_shader_; |
| 85 FragmentShader fragment_shader_; | 88 FragmentShader fragment_shader_; |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 } // namespace cc | 91 } // namespace cc |
| 89 | 92 |
| 90 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ | 93 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ |
| OLD | NEW |