| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 private: | 46 private: |
| 47 DISALLOW_COPY_AND_ASSIGN(ProgramBindingBase); | 47 DISALLOW_COPY_AND_ASSIGN(ProgramBindingBase); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 template <class VertexShader, class FragmentShader> | 50 template <class VertexShader, class FragmentShader> |
| 51 class ProgramBinding : public ProgramBindingBase { | 51 class ProgramBinding : public ProgramBindingBase { |
| 52 public: | 52 public: |
| 53 ProgramBinding() {} | 53 ProgramBinding() {} |
| 54 | 54 |
| 55 void Initialize(ContextProvider* context_provider, | 55 void Initialize(ContextProvider* context_provider, |
| 56 TexCoordPrecision precision) { | 56 TexCoordPrecision precision, |
| 57 SamplerType sampler) { |
| 57 DCHECK(context_provider); | 58 DCHECK(context_provider); |
| 58 DCHECK(!initialized_); | 59 DCHECK(!initialized_); |
| 59 | 60 |
| 60 if (context_provider->IsContextLost()) | 61 if (context_provider->IsContextLost()) |
| 61 return; | 62 return; |
| 62 | 63 |
| 63 if (!ProgramBindingBase::Init( | 64 if (!ProgramBindingBase::Init( |
| 64 context_provider->Context3d(), | 65 context_provider->Context3d(), |
| 65 vertex_shader_.GetShaderString(), | 66 vertex_shader_.GetShaderString(), |
| 66 fragment_shader_.GetShaderString(precision))) { | 67 fragment_shader_.GetShaderString(precision, sampler))) { |
| 67 DCHECK(context_provider->IsContextLost()); | 68 DCHECK(context_provider->IsContextLost()); |
| 68 return; | 69 return; |
| 69 } | 70 } |
| 70 | 71 |
| 71 int base_uniform_index = 0; | 72 int base_uniform_index = 0; |
| 72 vertex_shader_.Init(context_provider->Context3d(), | 73 vertex_shader_.Init(context_provider->Context3d(), |
| 73 program_, &base_uniform_index); | 74 program_, &base_uniform_index); |
| 74 fragment_shader_.Init(context_provider->Context3d(), | 75 fragment_shader_.Init(context_provider->Context3d(), |
| 75 program_, &base_uniform_index); | 76 program_, &base_uniform_index); |
| 76 | 77 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 89 private: | 90 private: |
| 90 VertexShader vertex_shader_; | 91 VertexShader vertex_shader_; |
| 91 FragmentShader fragment_shader_; | 92 FragmentShader fragment_shader_; |
| 92 | 93 |
| 93 DISALLOW_COPY_AND_ASSIGN(ProgramBinding); | 94 DISALLOW_COPY_AND_ASSIGN(ProgramBinding); |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } // namespace cc | 97 } // namespace cc |
| 97 | 98 |
| 98 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ | 99 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ |
| OLD | NEW |