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 <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "gpu/command_buffer/service/gl_utils.h" | 14 #include "gpu/command_buffer/service/gl_utils.h" |
15 #include "gpu/command_buffer/service/sampler_manager.h" | 15 #include "gpu/command_buffer/service/sampler_manager.h" |
| 16 #include "gpu/command_buffer/service/shader_manager.h" |
16 #include "gpu/command_buffer/service/texture_manager.h" | 17 #include "gpu/command_buffer/service/texture_manager.h" |
17 #include "gpu/command_buffer/service/vertex_array_manager.h" | 18 #include "gpu/command_buffer/service/vertex_array_manager.h" |
18 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 19 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
19 #include "gpu/gpu_export.h" | 20 #include "gpu/gpu_export.h" |
20 | 21 |
21 namespace gpu { | 22 namespace gpu { |
22 namespace gles2 { | 23 namespace gles2 { |
23 | 24 |
24 class Buffer; | 25 class Buffer; |
25 class ErrorState; | 26 class ErrorState; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return bound_texture_2d_array; | 101 return bound_texture_2d_array; |
101 } | 102 } |
102 | 103 |
103 NOTREACHED(); | 104 NOTREACHED(); |
104 return bound_texture_2d; | 105 return bound_texture_2d; |
105 } | 106 } |
106 }; | 107 }; |
107 | 108 |
108 class GPU_EXPORT Vec4 { | 109 class GPU_EXPORT Vec4 { |
109 public: | 110 public: |
110 enum DataType { | |
111 kFloat, | |
112 kInt, | |
113 kUInt, | |
114 }; | |
115 | |
116 Vec4() { | 111 Vec4() { |
117 v_[0].float_value = 0.0f; | 112 v_[0].float_value = 0.0f; |
118 v_[1].float_value = 0.0f; | 113 v_[1].float_value = 0.0f; |
119 v_[2].float_value = 0.0f; | 114 v_[2].float_value = 0.0f; |
120 v_[3].float_value = 1.0f; | 115 v_[3].float_value = 1.0f; |
121 type_ = kFloat; | 116 type_ = SHADER_VARIABLE_FLOAT; |
122 } | 117 } |
123 | 118 |
124 template <typename T> | 119 template <typename T> |
125 void GetValues(T* values) const; | 120 void GetValues(T* values) const; |
126 | 121 |
127 template <typename T> | 122 template <typename T> |
128 void SetValues(const T* values); | 123 void SetValues(const T* values); |
129 | 124 |
130 DataType type() const { | 125 ShaderVariableBaseType type() const { |
131 return type_; | 126 return type_; |
132 } | 127 } |
133 | 128 |
134 bool Equal(const Vec4& other) const; | 129 bool Equal(const Vec4& other) const; |
135 | 130 |
136 private: | 131 private: |
137 union ValueUnion { | 132 union ValueUnion { |
138 GLfloat float_value; | 133 GLfloat float_value; |
139 GLint int_value; | 134 GLint int_value; |
140 GLuint uint_value; | 135 GLuint uint_value; |
141 }; | 136 }; |
142 | 137 |
143 ValueUnion v_[4]; | 138 ValueUnion v_[4]; |
144 DataType type_; | 139 ShaderVariableBaseType type_; |
145 }; | 140 }; |
146 | 141 |
147 template <> | 142 template <> |
148 GPU_EXPORT void Vec4::GetValues<GLfloat>(GLfloat* values) const; | 143 GPU_EXPORT void Vec4::GetValues<GLfloat>(GLfloat* values) const; |
149 template <> | 144 template <> |
150 GPU_EXPORT void Vec4::GetValues<GLint>(GLint* values) const; | 145 GPU_EXPORT void Vec4::GetValues<GLint>(GLint* values) const; |
151 template <> | 146 template <> |
152 GPU_EXPORT void Vec4::GetValues<GLuint>(GLuint* values) const; | 147 GPU_EXPORT void Vec4::GetValues<GLuint>(GLuint* values) const; |
153 | 148 |
154 template <> | 149 template <> |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 322 |
328 FeatureInfo* feature_info_; | 323 FeatureInfo* feature_info_; |
329 std::unique_ptr<ErrorState> error_state_; | 324 std::unique_ptr<ErrorState> error_state_; |
330 }; | 325 }; |
331 | 326 |
332 } // namespace gles2 | 327 } // namespace gles2 |
333 } // namespace gpu | 328 } // namespace gpu |
334 | 329 |
335 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 330 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
336 | 331 |
OLD | NEW |