| 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" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 DISALLOW_COPY_AND_ASSIGN(ProgramBindingBase); | 51 DISALLOW_COPY_AND_ASSIGN(ProgramBindingBase); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 template <class VertexShader, class FragmentShader> | 54 template <class VertexShader, class FragmentShader> |
| 55 class ProgramBinding : public ProgramBindingBase { | 55 class ProgramBinding : public ProgramBindingBase { |
| 56 public: | 56 public: |
| 57 ProgramBinding() {} | 57 ProgramBinding() {} |
| 58 | 58 |
| 59 void Initialize(ContextProvider* context_provider, | 59 void Initialize(ContextProvider* context_provider, |
| 60 TexCoordPrecision precision, | 60 TexCoordPrecision precision, |
| 61 SamplerType sampler) { | 61 SamplerType sampler, |
| 62 BlendMode blend_mode = BlendModeNormal) { |
| 62 DCHECK(context_provider); | 63 DCHECK(context_provider); |
| 63 DCHECK(!initialized_); | 64 DCHECK(!initialized_); |
| 64 | 65 |
| 65 if (context_provider->IsContextLost()) | 66 if (context_provider->IsContextLost()) |
| 66 return; | 67 return; |
| 67 | 68 |
| 69 fragment_shader_.set_blend_mode(blend_mode); |
| 70 |
| 68 if (!ProgramBindingBase::Init( | 71 if (!ProgramBindingBase::Init( |
| 69 context_provider->ContextGL(), | 72 context_provider->ContextGL(), |
| 70 vertex_shader_.GetShaderString(), | 73 vertex_shader_.GetShaderString(), |
| 71 fragment_shader_.GetShaderString(precision, sampler))) { | 74 fragment_shader_.GetShaderString(precision, sampler))) { |
| 72 DCHECK(context_provider->IsContextLost()); | 75 DCHECK(context_provider->IsContextLost()); |
| 73 return; | 76 return; |
| 74 } | 77 } |
| 75 | 78 |
| 76 int base_uniform_index = 0; | 79 int base_uniform_index = 0; |
| 77 vertex_shader_.Init(context_provider->ContextGL(), | 80 vertex_shader_.Init(context_provider->ContextGL(), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 94 private: | 97 private: |
| 95 VertexShader vertex_shader_; | 98 VertexShader vertex_shader_; |
| 96 FragmentShader fragment_shader_; | 99 FragmentShader fragment_shader_; |
| 97 | 100 |
| 98 DISALLOW_COPY_AND_ASSIGN(ProgramBinding); | 101 DISALLOW_COPY_AND_ASSIGN(ProgramBinding); |
| 99 }; | 102 }; |
| 100 | 103 |
| 101 } // namespace cc | 104 } // namespace cc |
| 102 | 105 |
| 103 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ | 106 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ |
| OLD | NEW |