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> |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 template <> | 146 template <> |
147 GPU_EXPORT void Vec4::GetValues<GLuint>(GLuint* values) const; | 147 GPU_EXPORT void Vec4::GetValues<GLuint>(GLuint* values) const; |
148 | 148 |
149 template <> | 149 template <> |
150 GPU_EXPORT void Vec4::SetValues<GLfloat>(const GLfloat* values); | 150 GPU_EXPORT void Vec4::SetValues<GLfloat>(const GLfloat* values); |
151 template <> | 151 template <> |
152 GPU_EXPORT void Vec4::SetValues<GLint>(const GLint* values); | 152 GPU_EXPORT void Vec4::SetValues<GLint>(const GLint* values); |
153 template <> | 153 template <> |
154 GPU_EXPORT void Vec4::SetValues<GLuint>(const GLuint* values); | 154 GPU_EXPORT void Vec4::SetValues<GLuint>(const GLuint* values); |
155 | 155 |
| 156 enum FramebufferSRGBState { |
| 157 FRAMEBUFFER_SRGB_UNDEFINED, |
| 158 FRAMEBUFFER_SRGB_DISABLED, |
| 159 FRAMEBUFFER_SRGB_ENABLED |
| 160 }; |
| 161 |
156 struct GPU_EXPORT ContextState { | 162 struct GPU_EXPORT ContextState { |
157 enum Dimension { | 163 enum Dimension { |
158 k2D, | 164 k2D, |
159 k3D | 165 k3D |
160 }; | 166 }; |
161 | 167 |
162 ContextState(FeatureInfo* feature_info, | 168 ContextState(FeatureInfo* feature_info, |
163 ErrorStateClient* error_state_client, | 169 ErrorStateClient* error_state_client, |
164 Logger* logger); | 170 Logger* logger); |
165 ~ContextState(); | 171 ~ContextState(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 const std::vector<uint32_t>& generic_attrib_base_type_mask() const { | 271 const std::vector<uint32_t>& generic_attrib_base_type_mask() const { |
266 return generic_attrib_base_type_mask_; | 272 return generic_attrib_base_type_mask_; |
267 } | 273 } |
268 | 274 |
269 void UnbindTexture(TextureRef* texture); | 275 void UnbindTexture(TextureRef* texture); |
270 void UnbindSampler(Sampler* sampler); | 276 void UnbindSampler(Sampler* sampler); |
271 | 277 |
272 PixelStoreParams GetPackParams(); | 278 PixelStoreParams GetPackParams(); |
273 PixelStoreParams GetUnpackParams(Dimension dimension); | 279 PixelStoreParams GetUnpackParams(Dimension dimension); |
274 | 280 |
275 void EnableDisableFramebufferSRGB(bool enable); | 281 void EnableDisableFramebufferSRGB(FramebufferSRGBState enable); |
276 | 282 |
277 #include "gpu/command_buffer/service/context_state_autogen.h" | 283 #include "gpu/command_buffer/service/context_state_autogen.h" |
278 | 284 |
279 EnableFlags enable_flags; | 285 EnableFlags enable_flags; |
280 | 286 |
281 // Current active texture by 0 - n index. | 287 // Current active texture by 0 - n index. |
282 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would | 288 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would |
283 // be 2. | 289 // be 2. |
284 GLuint active_texture_unit; | 290 GLuint active_texture_unit; |
285 | 291 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 340 |
335 // If a buffer object is bound to PIXEL_PACK_BUFFER, set all pack parameters | 341 // If a buffer object is bound to PIXEL_PACK_BUFFER, set all pack parameters |
336 // user values; otherwise, set them to 0. | 342 // user values; otherwise, set them to 0. |
337 void UpdatePackParameters() const; | 343 void UpdatePackParameters() const; |
338 // If a buffer object is bound to PIXEL_UNPACK_BUFFER, set all unpack | 344 // If a buffer object is bound to PIXEL_UNPACK_BUFFER, set all unpack |
339 // parameters user values; otherwise, set them to 0. | 345 // parameters user values; otherwise, set them to 0. |
340 void UpdateUnpackParameters() const; | 346 void UpdateUnpackParameters() const; |
341 | 347 |
342 void InitStateManual(const ContextState* prev_state) const; | 348 void InitStateManual(const ContextState* prev_state) const; |
343 | 349 |
344 bool framebuffer_srgb_; | 350 FramebufferSRGBState framebuffer_srgb_; |
345 | 351 |
346 // Generic vertex attrib base types: FLOAT, INT, or UINT. | 352 // Generic vertex attrib base types: FLOAT, INT, or UINT. |
347 // Each base type is encoded into 2 bits, the lowest 2 bits for location 0, | 353 // Each base type is encoded into 2 bits, the lowest 2 bits for location 0, |
348 // the highest 2 bits for location (max_vertex_attribs - 1). | 354 // the highest 2 bits for location (max_vertex_attribs - 1). |
349 std::vector<uint32_t> generic_attrib_base_type_mask_; | 355 std::vector<uint32_t> generic_attrib_base_type_mask_; |
350 | 356 |
351 FeatureInfo* feature_info_; | 357 FeatureInfo* feature_info_; |
352 std::unique_ptr<ErrorState> error_state_; | 358 std::unique_ptr<ErrorState> error_state_; |
353 }; | 359 }; |
354 | 360 |
355 } // namespace gles2 | 361 } // namespace gles2 |
356 } // namespace gpu | 362 } // namespace gpu |
357 | 363 |
358 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 364 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
359 | 365 |
OLD | NEW |