| 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 template <typename T> |
| 121 void GetValues(T* values) const; |
| 122 |
| 123 template <typename T> |
| 124 void SetValues(const T* values); |
| 125 |
| 126 DataType type() const { |
| 127 return type_; |
| 128 } |
| 129 |
| 130 bool Equal(const Vec4& other) const; |
| 131 |
| 132 private: |
| 133 union ValueUnion { |
| 134 GLfloat float_value; |
| 135 GLint int_value; |
| 136 GLuint uint_value; |
| 137 }; |
| 138 |
| 139 ValueUnion v_[4]; |
| 140 DataType type_; |
| 112 }; | 141 }; |
| 113 | 142 |
| 143 template <> |
| 144 GPU_EXPORT void Vec4::GetValues<GLfloat>(GLfloat* values) const; |
| 145 template <> |
| 146 GPU_EXPORT void Vec4::GetValues<GLint>(GLint* values) const; |
| 147 template <> |
| 148 GPU_EXPORT void Vec4::GetValues<GLuint>(GLuint* values) const; |
| 149 |
| 150 template <> |
| 151 GPU_EXPORT void Vec4::SetValues<GLfloat>(const GLfloat* values); |
| 152 template <> |
| 153 GPU_EXPORT void Vec4::SetValues<GLint>(const GLint* values); |
| 154 template <> |
| 155 GPU_EXPORT void Vec4::SetValues<GLuint>(const GLuint* values); |
| 156 |
| 114 struct GPU_EXPORT ContextState { | 157 struct GPU_EXPORT ContextState { |
| 115 ContextState(FeatureInfo* feature_info, | 158 ContextState(FeatureInfo* feature_info, |
| 116 ErrorStateClient* error_state_client, | 159 ErrorStateClient* error_state_client, |
| 117 Logger* logger); | 160 Logger* logger); |
| 118 ~ContextState(); | 161 ~ContextState(); |
| 119 | 162 |
| 120 void Initialize(); | 163 void Initialize(); |
| 121 | 164 |
| 122 void SetIgnoreCachedStateForTest(bool ignore) { | 165 void SetIgnoreCachedStateForTest(bool ignore) { |
| 123 ignore_cached_state = ignore; | 166 ignore_cached_state = ignore; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 278 |
| 236 FeatureInfo* feature_info_; | 279 FeatureInfo* feature_info_; |
| 237 scoped_ptr<ErrorState> error_state_; | 280 scoped_ptr<ErrorState> error_state_; |
| 238 }; | 281 }; |
| 239 | 282 |
| 240 } // namespace gles2 | 283 } // namespace gles2 |
| 241 } // namespace gpu | 284 } // namespace gpu |
| 242 | 285 |
| 243 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 286 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| 244 | 287 |
| OLD | NEW |