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) { |
| 62 return Initialize( |
| 63 context_provider, precision, sampler, BLEND_MODE_NONE, false); |
| 64 } |
| 65 |
| 66 void Initialize(ContextProvider* context_provider, |
| 67 TexCoordPrecision precision, |
61 SamplerType sampler, | 68 SamplerType sampler, |
62 BlendMode blend_mode = BLEND_MODE_NONE) { | 69 BlendMode blend_mode) { |
| 70 return Initialize( |
| 71 context_provider, precision, sampler, blend_mode, false); |
| 72 } |
| 73 |
| 74 void Initialize(ContextProvider* context_provider, |
| 75 TexCoordPrecision precision, |
| 76 SamplerType sampler, |
| 77 BlendMode blend_mode, |
| 78 bool mask_for_background) { |
63 DCHECK(context_provider); | 79 DCHECK(context_provider); |
64 DCHECK(!initialized_); | 80 DCHECK(!initialized_); |
65 | 81 |
66 if (context_provider->IsContextLost()) | 82 if (context_provider->IsContextLost()) |
67 return; | 83 return; |
68 | 84 |
69 fragment_shader_.set_blend_mode(blend_mode); | 85 fragment_shader_.set_blend_mode(blend_mode); |
| 86 fragment_shader_.set_mask_for_background(mask_for_background); |
70 | 87 |
71 if (!ProgramBindingBase::Init( | 88 if (!ProgramBindingBase::Init( |
72 context_provider->ContextGL(), | 89 context_provider->ContextGL(), |
73 vertex_shader_.GetShaderString(), | 90 vertex_shader_.GetShaderString(), |
74 fragment_shader_.GetShaderString(precision, sampler))) { | 91 fragment_shader_.GetShaderString(precision, sampler))) { |
75 DCHECK(context_provider->IsContextLost()); | 92 DCHECK(context_provider->IsContextLost()); |
76 return; | 93 return; |
77 } | 94 } |
78 | 95 |
79 int base_uniform_index = 0; | 96 int base_uniform_index = 0; |
(...skipping 17 matching lines...) Expand all Loading... |
97 private: | 114 private: |
98 VertexShader vertex_shader_; | 115 VertexShader vertex_shader_; |
99 FragmentShader fragment_shader_; | 116 FragmentShader fragment_shader_; |
100 | 117 |
101 DISALLOW_COPY_AND_ASSIGN(ProgramBinding); | 118 DISALLOW_COPY_AND_ASSIGN(ProgramBinding); |
102 }; | 119 }; |
103 | 120 |
104 } // namespace cc | 121 } // namespace cc |
105 | 122 |
106 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ | 123 #endif // CC_OUTPUT_PROGRAM_BINDING_H_ |
OLD | NEW |