| 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 is here so other GLES2 related files can have a common set of | 5 // This file is here so other GLES2 related files can have a common set of |
| 6 // includes where appropriate. | 6 // includes where appropriate. |
| 7 | 7 |
| 8 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ | 8 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ |
| 9 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ | 9 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ |
| 10 | 10 |
| 11 #include <stddef.h> | 11 #include <stddef.h> |
| 12 #include <stdint.h> | 12 #include <stdint.h> |
| 13 | 13 |
| 14 #include <limits> | 14 #include <limits> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/numerics/safe_math.h" | 19 #include "base/numerics/safe_math.h" |
| 20 #include "gpu/command_buffer/common/gles2_utils_export.h" | 20 #include "gpu/command_buffer/common/gles2_utils_export.h" |
| 21 #include "ui/gfx/geometry/size.h" | |
| 22 #include "ui/gl/gpu_preference.h" | |
| 23 | 21 |
| 24 namespace gpu { | 22 namespace gpu { |
| 25 namespace gles2 { | 23 namespace gles2 { |
| 26 | 24 |
| 27 // Does a multiply and checks for overflow. If the multiply did not overflow | 25 // Does a multiply and checks for overflow. If the multiply did not overflow |
| 28 // returns true. | 26 // returns true. |
| 29 | 27 |
| 30 // Multiplies 2 32 bit unsigned numbers checking for overflow. | 28 // Multiplies 2 32 bit unsigned numbers checking for overflow. |
| 31 // If there was no overflow returns true. | 29 // If there was no overflow returns true. |
| 32 inline bool SafeMultiplyUint32(uint32_t a, uint32_t b, uint32_t* dst) { | 30 inline bool SafeMultiplyUint32(uint32_t a, uint32_t b, uint32_t* dst) { |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 CONTEXT_TYPE_OPENGLES3, | 300 CONTEXT_TYPE_OPENGLES3, |
| 303 CONTEXT_TYPE_LAST = CONTEXT_TYPE_OPENGLES3 | 301 CONTEXT_TYPE_LAST = CONTEXT_TYPE_OPENGLES3 |
| 304 }; | 302 }; |
| 305 | 303 |
| 306 struct GLES2_UTILS_EXPORT ContextCreationAttribHelper { | 304 struct GLES2_UTILS_EXPORT ContextCreationAttribHelper { |
| 307 ContextCreationAttribHelper(); | 305 ContextCreationAttribHelper(); |
| 308 ContextCreationAttribHelper(const ContextCreationAttribHelper& other); | 306 ContextCreationAttribHelper(const ContextCreationAttribHelper& other); |
| 309 | 307 |
| 310 bool Parse(const std::vector<int32_t>& attribs); | 308 bool Parse(const std::vector<int32_t>& attribs); |
| 311 | 309 |
| 312 gfx::Size offscreen_framebuffer_size; | |
| 313 gl::GpuPreference gpu_preference; | |
| 314 // -1 if invalid or unspecified. | 310 // -1 if invalid or unspecified. |
| 315 int32_t alpha_size; | 311 int32_t alpha_size; |
| 316 int32_t blue_size; | 312 int32_t blue_size; |
| 317 int32_t green_size; | 313 int32_t green_size; |
| 318 int32_t red_size; | 314 int32_t red_size; |
| 319 int32_t depth_size; | 315 int32_t depth_size; |
| 320 int32_t stencil_size; | 316 int32_t stencil_size; |
| 321 int32_t samples; | 317 int32_t samples; |
| 322 int32_t sample_buffers; | 318 int32_t sample_buffers; |
| 323 bool buffer_preserved; | 319 bool buffer_preserved; |
| 324 bool bind_generates_resource; | 320 bool bind_generates_resource; |
| 325 bool fail_if_major_perf_caveat; | 321 bool fail_if_major_perf_caveat; |
| 326 bool lose_context_when_out_of_memory; | 322 bool lose_context_when_out_of_memory; |
| 327 bool should_use_native_gmb_for_backbuffer; | 323 bool should_use_native_gmb_for_backbuffer; |
| 328 | 324 |
| 329 ContextType context_type; | 325 ContextType context_type; |
| 330 }; | 326 }; |
| 331 | 327 |
| 332 } // namespace gles2 | 328 } // namespace gles2 |
| 333 } // namespace gpu | 329 } // namespace gpu |
| 334 | 330 |
| 335 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ | 331 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ |
| 336 | 332 |
| OLD | NEW |