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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 struct Vec4 { |
105 enum DataType { | |
106 kFloat, | |
107 kInt, | |
108 kUInt, | |
109 }; | |
110 | |
105 Vec4() { | 111 Vec4() { |
106 v[0] = 0.0f; | 112 v[0] = 0.0f; |
107 v[1] = 0.0f; | 113 v[1] = 0.0f; |
108 v[2] = 0.0f; | 114 v[2] = 0.0f; |
109 v[3] = 1.0f; | 115 v[3] = 1.0f; |
116 type = kFloat; | |
110 } | 117 } |
118 // Use double type here so when storing data of type GLfloat, GLint, | |
119 // or GLuint, there will be no data loss. | |
piman
2015/05/13 01:47:45
Or you could use a union.
Zhenyao Mo
2015/05/13 16:52:25
Done.
| |
111 float v[4]; | 120 float v[4]; |
121 DataType type; | |
112 }; | 122 }; |
113 | 123 |
114 struct GPU_EXPORT ContextState { | 124 struct GPU_EXPORT ContextState { |
115 ContextState(FeatureInfo* feature_info, | 125 ContextState(FeatureInfo* feature_info, |
116 ErrorStateClient* error_state_client, | 126 ErrorStateClient* error_state_client, |
117 Logger* logger); | 127 Logger* logger); |
118 ~ContextState(); | 128 ~ContextState(); |
119 | 129 |
120 void Initialize(); | 130 void Initialize(); |
121 | 131 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 | 245 |
236 FeatureInfo* feature_info_; | 246 FeatureInfo* feature_info_; |
237 scoped_ptr<ErrorState> error_state_; | 247 scoped_ptr<ErrorState> error_state_; |
238 }; | 248 }; |
239 | 249 |
240 } // namespace gles2 | 250 } // namespace gles2 |
241 } // namespace gpu | 251 } // namespace gpu |
242 | 252 |
243 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 253 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
244 | 254 |
OLD | NEW |