Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: gpu/command_buffer/service/context_state.h

Issue 1136713003: Add ES3 commands GetVertexAttribI{u}iv to GPU command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: switch to union Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
114 struct GPU_EXPORT ContextState { 143 struct GPU_EXPORT ContextState {
115 ContextState(FeatureInfo* feature_info, 144 ContextState(FeatureInfo* feature_info,
116 ErrorStateClient* error_state_client, 145 ErrorStateClient* error_state_client,
117 Logger* logger); 146 Logger* logger);
118 ~ContextState(); 147 ~ContextState();
119 148
120 void Initialize(); 149 void Initialize();
121 150
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 264
236 FeatureInfo* feature_info_; 265 FeatureInfo* feature_info_;
237 scoped_ptr<ErrorState> error_state_; 266 scoped_ptr<ErrorState> error_state_;
238 }; 267 };
239 268
240 } // namespace gles2 269 } // namespace gles2
241 } // namespace gpu 270 } // namespace gpu
242 271
243 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 272 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
244 273
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698