Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains the ContextState class. | 5 // This file contains the ContextState class. |
| 6 | 6 |
| 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| 8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 } | 94 } |
| 95 if (bound_texture_3d.get() == texture) { | 95 if (bound_texture_3d.get() == texture) { |
| 96 bound_texture_3d = NULL; | 96 bound_texture_3d = NULL; |
| 97 } | 97 } |
| 98 if (bound_texture_2d_array.get() == texture) { | 98 if (bound_texture_2d_array.get() == texture) { |
| 99 bound_texture_2d_array = NULL; | 99 bound_texture_2d_array = NULL; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 struct Vec4 { | 104 class GPU_EXPORT Vec4 { |
| 105 public: | |
| 106 enum DataType { | |
| 107 kFloat, | |
| 108 kInt, | |
| 109 kUInt, | |
| 110 }; | |
| 111 | |
| 105 Vec4() { | 112 Vec4() { |
| 106 v[0] = 0.0f; | 113 v_[0].float_value = 0.0f; |
| 107 v[1] = 0.0f; | 114 v_[1].float_value = 0.0f; |
| 108 v[2] = 0.0f; | 115 v_[2].float_value = 0.0f; |
| 109 v[3] = 1.0f; | 116 v_[3].float_value = 1.0f; |
| 117 type_ = kFloat; | |
| 110 } | 118 } |
| 111 float v[4]; | 119 |
| 120 void GetValues(GLfloat* values) const; | |
|
piman
2015/05/13 19:33:27
nit: we typically disallow overloading per style g
| |
| 121 void GetValues(GLint* values) const; | |
| 122 void GetValues(GLuint* values) const; | |
| 123 | |
| 124 void SetValues(const GLfloat* values); | |
| 125 void SetValues(const GLint* values); | |
| 126 void SetValues(const GLuint* values); | |
| 127 | |
| 128 DataType type() const { | |
| 129 return type_; | |
| 130 } | |
| 131 | |
| 132 bool Equal(const Vec4& other) const; | |
| 133 | |
| 134 private: | |
| 135 union ValueUnion { | |
| 136 GLfloat float_value; | |
| 137 GLint int_value; | |
| 138 GLuint uint_value; | |
| 139 }; | |
| 140 | |
| 141 ValueUnion v_[4]; | |
| 142 DataType type_; | |
| 112 }; | 143 }; |
| 113 | 144 |
| 114 struct GPU_EXPORT ContextState { | 145 struct GPU_EXPORT ContextState { |
| 115 ContextState(FeatureInfo* feature_info, | 146 ContextState(FeatureInfo* feature_info, |
| 116 ErrorStateClient* error_state_client, | 147 ErrorStateClient* error_state_client, |
| 117 Logger* logger); | 148 Logger* logger); |
| 118 ~ContextState(); | 149 ~ContextState(); |
| 119 | 150 |
| 120 void Initialize(); | 151 void Initialize(); |
| 121 | 152 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 | 266 |
| 236 FeatureInfo* feature_info_; | 267 FeatureInfo* feature_info_; |
| 237 scoped_ptr<ErrorState> error_state_; | 268 scoped_ptr<ErrorState> error_state_; |
| 238 }; | 269 }; |
| 239 | 270 |
| 240 } // namespace gles2 | 271 } // namespace gles2 |
| 241 } // namespace gpu | 272 } // namespace gpu |
| 242 | 273 |
| 243 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 274 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| 244 | 275 |
| OLD | NEW |