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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <cmath> | 13 #include <cmath> |
14 #include <list> | 14 #include <list> |
15 #include <map> | 15 #include <map> |
| 16 #include <memory> |
16 #include <queue> | 17 #include <queue> |
17 | 18 |
18 #include "base/callback.h" | 19 #include "base/callback.h" |
19 #include "base/callback_helpers.h" | 20 #include "base/callback_helpers.h" |
20 #include "base/logging.h" | 21 #include "base/logging.h" |
21 #include "base/memory/linked_ptr.h" | 22 #include "base/memory/linked_ptr.h" |
22 #include "base/memory/scoped_ptr.h" | |
23 #include "base/metrics/histogram_macros.h" | 23 #include "base/metrics/histogram_macros.h" |
24 #include "base/numerics/safe_math.h" | 24 #include "base/numerics/safe_math.h" |
25 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
26 #include "base/trace_event/trace_event.h" | 26 #include "base/trace_event/trace_event.h" |
27 #include "base/trace_event/trace_event_synthetic_delay.h" | 27 #include "base/trace_event/trace_event_synthetic_delay.h" |
28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
29 #include "gpu/command_buffer/common/debug_marker_manager.h" | 29 #include "gpu/command_buffer/common/debug_marker_manager.h" |
30 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 30 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
31 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 31 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
32 #include "gpu/command_buffer/common/mailbox.h" | 32 #include "gpu/command_buffer/common/mailbox.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 // framebuffer are restored. | 394 // framebuffer are restored. |
395 class ScopedFrameBufferReadPixelHelper { | 395 class ScopedFrameBufferReadPixelHelper { |
396 public: | 396 public: |
397 ScopedFrameBufferReadPixelHelper(ContextState* state, | 397 ScopedFrameBufferReadPixelHelper(ContextState* state, |
398 GLES2DecoderImpl* decoder); | 398 GLES2DecoderImpl* decoder); |
399 ~ScopedFrameBufferReadPixelHelper(); | 399 ~ScopedFrameBufferReadPixelHelper(); |
400 | 400 |
401 private: | 401 private: |
402 GLuint temp_texture_id_ = 0; | 402 GLuint temp_texture_id_ = 0; |
403 GLuint temp_fbo_id_ = 0; | 403 GLuint temp_fbo_id_ = 0; |
404 scoped_ptr<ScopedFrameBufferBinder> fbo_binder_; | 404 std::unique_ptr<ScopedFrameBufferBinder> fbo_binder_; |
405 DISALLOW_COPY_AND_ASSIGN(ScopedFrameBufferReadPixelHelper); | 405 DISALLOW_COPY_AND_ASSIGN(ScopedFrameBufferReadPixelHelper); |
406 }; | 406 }; |
407 | 407 |
408 // Encapsulates an OpenGL texture. | 408 // Encapsulates an OpenGL texture. |
409 class BackTexture { | 409 class BackTexture { |
410 public: | 410 public: |
411 explicit BackTexture(MemoryTracker* memory_tracker, ContextState* state); | 411 explicit BackTexture(MemoryTracker* memory_tracker, ContextState* state); |
412 ~BackTexture(); | 412 ~BackTexture(); |
413 | 413 |
414 // Create a new render texture. | 414 // Create a new render texture. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 GLuint id_; | 520 GLuint id_; |
521 DISALLOW_COPY_AND_ASSIGN(BackFramebuffer); | 521 DISALLOW_COPY_AND_ASSIGN(BackFramebuffer); |
522 }; | 522 }; |
523 | 523 |
524 struct FenceCallback { | 524 struct FenceCallback { |
525 FenceCallback() | 525 FenceCallback() |
526 : fence(gfx::GLFence::Create()) { | 526 : fence(gfx::GLFence::Create()) { |
527 DCHECK(fence); | 527 DCHECK(fence); |
528 } | 528 } |
529 std::vector<base::Closure> callbacks; | 529 std::vector<base::Closure> callbacks; |
530 scoped_ptr<gfx::GLFence> fence; | 530 std::unique_ptr<gfx::GLFence> fence; |
531 }; | 531 }; |
532 | 532 |
533 // } // anonymous namespace. | 533 // } // anonymous namespace. |
534 | 534 |
535 // static | 535 // static |
536 const unsigned int GLES2Decoder::kDefaultStencilMask = | 536 const unsigned int GLES2Decoder::kDefaultStencilMask = |
537 static_cast<unsigned int>(-1); | 537 static_cast<unsigned int>(-1); |
538 | 538 |
539 bool GLES2Decoder::GetServiceTextureId(uint32_t client_texture_id, | 539 bool GLES2Decoder::GetServiceTextureId(uint32_t client_texture_id, |
540 uint32_t* service_texture_id) { | 540 uint32_t* service_texture_id) { |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 // The buffer used to simulate GL_FIXED attribs. | 2009 // The buffer used to simulate GL_FIXED attribs. |
2010 GLuint fixed_attrib_buffer_id_; | 2010 GLuint fixed_attrib_buffer_id_; |
2011 | 2011 |
2012 // The size of fiixed attrib buffer. | 2012 // The size of fiixed attrib buffer. |
2013 GLsizei fixed_attrib_buffer_size_; | 2013 GLsizei fixed_attrib_buffer_size_; |
2014 | 2014 |
2015 // The offscreen frame buffer that the client renders to. With EGL, the | 2015 // The offscreen frame buffer that the client renders to. With EGL, the |
2016 // depth and stencil buffers are separate. With regular GL there is a single | 2016 // depth and stencil buffers are separate. With regular GL there is a single |
2017 // packed depth stencil buffer in offscreen_target_depth_render_buffer_. | 2017 // packed depth stencil buffer in offscreen_target_depth_render_buffer_. |
2018 // offscreen_target_stencil_render_buffer_ is unused. | 2018 // offscreen_target_stencil_render_buffer_ is unused. |
2019 scoped_ptr<BackFramebuffer> offscreen_target_frame_buffer_; | 2019 std::unique_ptr<BackFramebuffer> offscreen_target_frame_buffer_; |
2020 scoped_ptr<BackTexture> offscreen_target_color_texture_; | 2020 std::unique_ptr<BackTexture> offscreen_target_color_texture_; |
2021 scoped_ptr<BackRenderbuffer> offscreen_target_color_render_buffer_; | 2021 std::unique_ptr<BackRenderbuffer> offscreen_target_color_render_buffer_; |
2022 scoped_ptr<BackRenderbuffer> offscreen_target_depth_render_buffer_; | 2022 std::unique_ptr<BackRenderbuffer> offscreen_target_depth_render_buffer_; |
2023 scoped_ptr<BackRenderbuffer> offscreen_target_stencil_render_buffer_; | 2023 std::unique_ptr<BackRenderbuffer> offscreen_target_stencil_render_buffer_; |
2024 GLenum offscreen_target_color_format_; | 2024 GLenum offscreen_target_color_format_; |
2025 GLenum offscreen_target_depth_format_; | 2025 GLenum offscreen_target_depth_format_; |
2026 GLenum offscreen_target_stencil_format_; | 2026 GLenum offscreen_target_stencil_format_; |
2027 GLsizei offscreen_target_samples_; | 2027 GLsizei offscreen_target_samples_; |
2028 GLboolean offscreen_target_buffer_preserved_; | 2028 GLboolean offscreen_target_buffer_preserved_; |
2029 | 2029 |
2030 // The copy that is saved when SwapBuffers is called. | 2030 // The copy that is saved when SwapBuffers is called. |
2031 scoped_ptr<BackFramebuffer> offscreen_saved_frame_buffer_; | 2031 std::unique_ptr<BackFramebuffer> offscreen_saved_frame_buffer_; |
2032 scoped_ptr<BackTexture> offscreen_saved_color_texture_; | 2032 std::unique_ptr<BackTexture> offscreen_saved_color_texture_; |
2033 scoped_refptr<TextureRef> | 2033 scoped_refptr<TextureRef> |
2034 offscreen_saved_color_texture_info_; | 2034 offscreen_saved_color_texture_info_; |
2035 | 2035 |
2036 // The copy that is used as the destination for multi-sample resolves. | 2036 // The copy that is used as the destination for multi-sample resolves. |
2037 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; | 2037 std::unique_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; |
2038 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; | 2038 std::unique_ptr<BackTexture> offscreen_resolved_color_texture_; |
2039 GLenum offscreen_saved_color_format_; | 2039 GLenum offscreen_saved_color_format_; |
2040 | 2040 |
2041 scoped_ptr<QueryManager> query_manager_; | 2041 std::unique_ptr<QueryManager> query_manager_; |
2042 | 2042 |
2043 scoped_ptr<VertexArrayManager> vertex_array_manager_; | 2043 std::unique_ptr<VertexArrayManager> vertex_array_manager_; |
2044 | 2044 |
2045 scoped_ptr<ImageManager> image_manager_; | 2045 std::unique_ptr<ImageManager> image_manager_; |
2046 | 2046 |
2047 FenceSyncReleaseCallback fence_sync_release_callback_; | 2047 FenceSyncReleaseCallback fence_sync_release_callback_; |
2048 WaitFenceSyncCallback wait_fence_sync_callback_; | 2048 WaitFenceSyncCallback wait_fence_sync_callback_; |
2049 | 2049 |
2050 ShaderCacheCallback shader_cache_callback_; | 2050 ShaderCacheCallback shader_cache_callback_; |
2051 | 2051 |
2052 // The format of the back buffer_ | 2052 // The format of the back buffer_ |
2053 GLenum back_buffer_color_format_; | 2053 GLenum back_buffer_color_format_; |
2054 bool back_buffer_has_depth_; | 2054 bool back_buffer_has_depth_; |
2055 bool back_buffer_has_stencil_; | 2055 bool back_buffer_has_stencil_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 bool lose_context_when_out_of_memory_; | 2111 bool lose_context_when_out_of_memory_; |
2112 | 2112 |
2113 // Log extra info. | 2113 // Log extra info. |
2114 bool service_logging_; | 2114 bool service_logging_; |
2115 | 2115 |
2116 #if defined(OS_MACOSX) | 2116 #if defined(OS_MACOSX) |
2117 typedef std::map<GLuint, IOSurfaceRef> TextureToIOSurfaceMap; | 2117 typedef std::map<GLuint, IOSurfaceRef> TextureToIOSurfaceMap; |
2118 TextureToIOSurfaceMap texture_to_io_surface_map_; | 2118 TextureToIOSurfaceMap texture_to_io_surface_map_; |
2119 #endif | 2119 #endif |
2120 | 2120 |
2121 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | 2121 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
2122 scoped_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; | 2122 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; |
2123 | 2123 |
2124 // Cached values of the currently assigned viewport dimensions. | 2124 // Cached values of the currently assigned viewport dimensions. |
2125 GLsizei viewport_max_width_; | 2125 GLsizei viewport_max_width_; |
2126 GLsizei viewport_max_height_; | 2126 GLsizei viewport_max_height_; |
2127 | 2127 |
2128 // Command buffer stats. | 2128 // Command buffer stats. |
2129 base::TimeDelta total_processing_commands_time_; | 2129 base::TimeDelta total_processing_commands_time_; |
2130 | 2130 |
2131 // States related to each manager. | 2131 // States related to each manager. |
2132 DecoderTextureState texture_state_; | 2132 DecoderTextureState texture_state_; |
2133 DecoderFramebufferState framebuffer_state_; | 2133 DecoderFramebufferState framebuffer_state_; |
2134 | 2134 |
2135 scoped_ptr<GPUTracer> gpu_tracer_; | 2135 std::unique_ptr<GPUTracer> gpu_tracer_; |
2136 scoped_ptr<GPUStateTracer> gpu_state_tracer_; | 2136 std::unique_ptr<GPUStateTracer> gpu_state_tracer_; |
2137 const unsigned char* gpu_decoder_category_; | 2137 const unsigned char* gpu_decoder_category_; |
2138 int gpu_trace_level_; | 2138 int gpu_trace_level_; |
2139 bool gpu_trace_commands_; | 2139 bool gpu_trace_commands_; |
2140 bool gpu_debug_commands_; | 2140 bool gpu_debug_commands_; |
2141 | 2141 |
2142 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; | 2142 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; |
2143 | 2143 |
2144 // Used to validate multisample renderbuffers if needed | 2144 // Used to validate multisample renderbuffers if needed |
2145 GLuint validation_texture_; | 2145 GLuint validation_texture_; |
2146 GLuint validation_fbo_multisample_; | 2146 GLuint validation_fbo_multisample_; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2415 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); | 2415 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); |
2416 uint32_t image_size = 0; | 2416 uint32_t image_size = 0; |
2417 GLES2Util::ComputeImageDataSizes( | 2417 GLES2Util::ComputeImageDataSizes( |
2418 size.width(), size.height(), 1, format, GL_UNSIGNED_BYTE, 8, &image_size, | 2418 size.width(), size.height(), 1, format, GL_UNSIGNED_BYTE, 8, &image_size, |
2419 NULL, NULL); | 2419 NULL, NULL); |
2420 | 2420 |
2421 if (!memory_tracker_.EnsureGPUMemoryAvailable(image_size)) { | 2421 if (!memory_tracker_.EnsureGPUMemoryAvailable(image_size)) { |
2422 return false; | 2422 return false; |
2423 } | 2423 } |
2424 | 2424 |
2425 scoped_ptr<char[]> zero_data; | 2425 std::unique_ptr<char[]> zero_data; |
2426 if (zero) { | 2426 if (zero) { |
2427 zero_data.reset(new char[image_size]); | 2427 zero_data.reset(new char[image_size]); |
2428 memset(zero_data.get(), 0, image_size); | 2428 memset(zero_data.get(), 0, image_size); |
2429 } | 2429 } |
2430 | 2430 |
2431 glTexImage2D(GL_TEXTURE_2D, | 2431 glTexImage2D(GL_TEXTURE_2D, |
2432 0, // mip level | 2432 0, // mip level |
2433 format, | 2433 format, |
2434 size.width(), | 2434 size.width(), |
2435 size.height(), | 2435 size.height(), |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3440 } | 3440 } |
3441 return true; | 3441 return true; |
3442 } | 3442 } |
3443 | 3443 |
3444 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { | 3444 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { |
3445 for (GLsizei ii = 0; ii < n; ++ii) { | 3445 for (GLsizei ii = 0; ii < n; ++ii) { |
3446 if (GetBuffer(client_ids[ii])) { | 3446 if (GetBuffer(client_ids[ii])) { |
3447 return false; | 3447 return false; |
3448 } | 3448 } |
3449 } | 3449 } |
3450 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3450 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3451 glGenBuffersARB(n, service_ids.get()); | 3451 glGenBuffersARB(n, service_ids.get()); |
3452 for (GLsizei ii = 0; ii < n; ++ii) { | 3452 for (GLsizei ii = 0; ii < n; ++ii) { |
3453 CreateBuffer(client_ids[ii], service_ids[ii]); | 3453 CreateBuffer(client_ids[ii], service_ids[ii]); |
3454 } | 3454 } |
3455 return true; | 3455 return true; |
3456 } | 3456 } |
3457 | 3457 |
3458 bool GLES2DecoderImpl::GenFramebuffersHelper( | 3458 bool GLES2DecoderImpl::GenFramebuffersHelper( |
3459 GLsizei n, const GLuint* client_ids) { | 3459 GLsizei n, const GLuint* client_ids) { |
3460 for (GLsizei ii = 0; ii < n; ++ii) { | 3460 for (GLsizei ii = 0; ii < n; ++ii) { |
3461 if (GetFramebuffer(client_ids[ii])) { | 3461 if (GetFramebuffer(client_ids[ii])) { |
3462 return false; | 3462 return false; |
3463 } | 3463 } |
3464 } | 3464 } |
3465 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3465 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3466 glGenFramebuffersEXT(n, service_ids.get()); | 3466 glGenFramebuffersEXT(n, service_ids.get()); |
3467 for (GLsizei ii = 0; ii < n; ++ii) { | 3467 for (GLsizei ii = 0; ii < n; ++ii) { |
3468 CreateFramebuffer(client_ids[ii], service_ids[ii]); | 3468 CreateFramebuffer(client_ids[ii], service_ids[ii]); |
3469 } | 3469 } |
3470 return true; | 3470 return true; |
3471 } | 3471 } |
3472 | 3472 |
3473 bool GLES2DecoderImpl::GenRenderbuffersHelper( | 3473 bool GLES2DecoderImpl::GenRenderbuffersHelper( |
3474 GLsizei n, const GLuint* client_ids) { | 3474 GLsizei n, const GLuint* client_ids) { |
3475 for (GLsizei ii = 0; ii < n; ++ii) { | 3475 for (GLsizei ii = 0; ii < n; ++ii) { |
3476 if (GetRenderbuffer(client_ids[ii])) { | 3476 if (GetRenderbuffer(client_ids[ii])) { |
3477 return false; | 3477 return false; |
3478 } | 3478 } |
3479 } | 3479 } |
3480 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3480 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3481 glGenRenderbuffersEXT(n, service_ids.get()); | 3481 glGenRenderbuffersEXT(n, service_ids.get()); |
3482 for (GLsizei ii = 0; ii < n; ++ii) { | 3482 for (GLsizei ii = 0; ii < n; ++ii) { |
3483 CreateRenderbuffer(client_ids[ii], service_ids[ii]); | 3483 CreateRenderbuffer(client_ids[ii], service_ids[ii]); |
3484 } | 3484 } |
3485 return true; | 3485 return true; |
3486 } | 3486 } |
3487 | 3487 |
3488 bool GLES2DecoderImpl::GenValuebuffersCHROMIUMHelper(GLsizei n, | 3488 bool GLES2DecoderImpl::GenValuebuffersCHROMIUMHelper(GLsizei n, |
3489 const GLuint* client_ids) { | 3489 const GLuint* client_ids) { |
3490 for (GLsizei ii = 0; ii < n; ++ii) { | 3490 for (GLsizei ii = 0; ii < n; ++ii) { |
3491 if (GetValuebuffer(client_ids[ii])) { | 3491 if (GetValuebuffer(client_ids[ii])) { |
3492 return false; | 3492 return false; |
3493 } | 3493 } |
3494 } | 3494 } |
3495 for (GLsizei ii = 0; ii < n; ++ii) { | 3495 for (GLsizei ii = 0; ii < n; ++ii) { |
3496 CreateValuebuffer(client_ids[ii]); | 3496 CreateValuebuffer(client_ids[ii]); |
3497 } | 3497 } |
3498 return true; | 3498 return true; |
3499 } | 3499 } |
3500 | 3500 |
3501 bool GLES2DecoderImpl::GenTexturesHelper(GLsizei n, const GLuint* client_ids) { | 3501 bool GLES2DecoderImpl::GenTexturesHelper(GLsizei n, const GLuint* client_ids) { |
3502 for (GLsizei ii = 0; ii < n; ++ii) { | 3502 for (GLsizei ii = 0; ii < n; ++ii) { |
3503 if (GetTexture(client_ids[ii])) { | 3503 if (GetTexture(client_ids[ii])) { |
3504 return false; | 3504 return false; |
3505 } | 3505 } |
3506 } | 3506 } |
3507 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3507 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3508 glGenTextures(n, service_ids.get()); | 3508 glGenTextures(n, service_ids.get()); |
3509 for (GLsizei ii = 0; ii < n; ++ii) { | 3509 for (GLsizei ii = 0; ii < n; ++ii) { |
3510 CreateTexture(client_ids[ii], service_ids[ii]); | 3510 CreateTexture(client_ids[ii], service_ids[ii]); |
3511 } | 3511 } |
3512 return true; | 3512 return true; |
3513 } | 3513 } |
3514 | 3514 |
3515 bool GLES2DecoderImpl::GenSamplersHelper(GLsizei n, const GLuint* client_ids) { | 3515 bool GLES2DecoderImpl::GenSamplersHelper(GLsizei n, const GLuint* client_ids) { |
3516 for (GLsizei ii = 0; ii < n; ++ii) { | 3516 for (GLsizei ii = 0; ii < n; ++ii) { |
3517 if (GetSampler(client_ids[ii])) { | 3517 if (GetSampler(client_ids[ii])) { |
3518 return false; | 3518 return false; |
3519 } | 3519 } |
3520 } | 3520 } |
3521 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3521 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3522 glGenSamplers(n, service_ids.get()); | 3522 glGenSamplers(n, service_ids.get()); |
3523 for (GLsizei ii = 0; ii < n; ++ii) { | 3523 for (GLsizei ii = 0; ii < n; ++ii) { |
3524 CreateSampler(client_ids[ii], service_ids[ii]); | 3524 CreateSampler(client_ids[ii], service_ids[ii]); |
3525 } | 3525 } |
3526 return true; | 3526 return true; |
3527 } | 3527 } |
3528 | 3528 |
3529 bool GLES2DecoderImpl::GenPathsCHROMIUMHelper(GLuint first_client_id, | 3529 bool GLES2DecoderImpl::GenPathsCHROMIUMHelper(GLuint first_client_id, |
3530 GLsizei range) { | 3530 GLsizei range) { |
3531 GLuint last_client_id; | 3531 GLuint last_client_id; |
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5104 } | 5104 } |
5105 | 5105 |
5106 if (width < 0 || height < 0) { | 5106 if (width < 0 || height < 0) { |
5107 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "negative size"); | 5107 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "negative size"); |
5108 return; | 5108 return; |
5109 } | 5109 } |
5110 | 5110 |
5111 // If the default framebuffer is bound but we are still rendering to an | 5111 // If the default framebuffer is bound but we are still rendering to an |
5112 // FBO, translate attachment names that refer to default framebuffer | 5112 // FBO, translate attachment names that refer to default framebuffer |
5113 // channels to corresponding framebuffer attachments. | 5113 // channels to corresponding framebuffer attachments. |
5114 scoped_ptr<GLenum[]> translated_attachments(new GLenum[count]); | 5114 std::unique_ptr<GLenum[]> translated_attachments(new GLenum[count]); |
5115 for (GLsizei i = 0; i < count; ++i) { | 5115 for (GLsizei i = 0; i < count; ++i) { |
5116 GLenum attachment = attachments[i]; | 5116 GLenum attachment = attachments[i]; |
5117 if (!framebuffer && GetBackbufferServiceId()) { | 5117 if (!framebuffer && GetBackbufferServiceId()) { |
5118 switch (attachment) { | 5118 switch (attachment) { |
5119 case GL_COLOR_EXT: | 5119 case GL_COLOR_EXT: |
5120 attachment = GL_COLOR_ATTACHMENT0; | 5120 attachment = GL_COLOR_ATTACHMENT0; |
5121 break; | 5121 break; |
5122 case GL_DEPTH_EXT: | 5122 case GL_DEPTH_EXT: |
5123 attachment = GL_DEPTH_ATTACHMENT; | 5123 attachment = GL_DEPTH_ATTACHMENT; |
5124 break; | 5124 break; |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5788 feature_info_->gl_version_info().is_desktop_core_profile) { | 5788 feature_info_->gl_version_info().is_desktop_core_profile) { |
5789 return GL_POINT_SIZE_RANGE; | 5789 return GL_POINT_SIZE_RANGE; |
5790 } | 5790 } |
5791 return pname; | 5791 return pname; |
5792 } | 5792 } |
5793 | 5793 |
5794 void GLES2DecoderImpl::DoGetBooleanv(GLenum pname, GLboolean* params) { | 5794 void GLES2DecoderImpl::DoGetBooleanv(GLenum pname, GLboolean* params) { |
5795 DCHECK(params); | 5795 DCHECK(params); |
5796 GLsizei num_written = 0; | 5796 GLsizei num_written = 0; |
5797 if (GetNumValuesReturnedForGLGet(pname, &num_written)) { | 5797 if (GetNumValuesReturnedForGLGet(pname, &num_written)) { |
5798 scoped_ptr<GLint[]> values(new GLint[num_written]); | 5798 std::unique_ptr<GLint[]> values(new GLint[num_written]); |
5799 if (!state_.GetStateAsGLint(pname, values.get(), &num_written)) { | 5799 if (!state_.GetStateAsGLint(pname, values.get(), &num_written)) { |
5800 GetHelper(pname, values.get(), &num_written); | 5800 GetHelper(pname, values.get(), &num_written); |
5801 } | 5801 } |
5802 for (GLsizei ii = 0; ii < num_written; ++ii) { | 5802 for (GLsizei ii = 0; ii < num_written; ++ii) { |
5803 params[ii] = static_cast<GLboolean>(values[ii]); | 5803 params[ii] = static_cast<GLboolean>(values[ii]); |
5804 } | 5804 } |
5805 } else { | 5805 } else { |
5806 pname = AdjustGetPname(pname); | 5806 pname = AdjustGetPname(pname); |
5807 glGetBooleanv(pname, params); | 5807 glGetBooleanv(pname, params); |
5808 } | 5808 } |
5809 } | 5809 } |
5810 | 5810 |
5811 void GLES2DecoderImpl::DoGetFloatv(GLenum pname, GLfloat* params) { | 5811 void GLES2DecoderImpl::DoGetFloatv(GLenum pname, GLfloat* params) { |
5812 DCHECK(params); | 5812 DCHECK(params); |
5813 GLsizei num_written = 0; | 5813 GLsizei num_written = 0; |
5814 if (!state_.GetStateAsGLfloat(pname, params, &num_written)) { | 5814 if (!state_.GetStateAsGLfloat(pname, params, &num_written)) { |
5815 if (GetHelper(pname, NULL, &num_written)) { | 5815 if (GetHelper(pname, NULL, &num_written)) { |
5816 scoped_ptr<GLint[]> values(new GLint[num_written]); | 5816 std::unique_ptr<GLint[]> values(new GLint[num_written]); |
5817 GetHelper(pname, values.get(), &num_written); | 5817 GetHelper(pname, values.get(), &num_written); |
5818 for (GLsizei ii = 0; ii < num_written; ++ii) { | 5818 for (GLsizei ii = 0; ii < num_written; ++ii) { |
5819 params[ii] = static_cast<GLfloat>(values[ii]); | 5819 params[ii] = static_cast<GLfloat>(values[ii]); |
5820 } | 5820 } |
5821 } else { | 5821 } else { |
5822 pname = AdjustGetPname(pname); | 5822 pname = AdjustGetPname(pname); |
5823 glGetFloatv(pname, params); | 5823 glGetFloatv(pname, params); |
5824 } | 5824 } |
5825 } | 5825 } |
5826 } | 5826 } |
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7470 GLint real_location = -1; | 7470 GLint real_location = -1; |
7471 if (!PrepForSetUniformByLocation(fake_location, | 7471 if (!PrepForSetUniformByLocation(fake_location, |
7472 "glUniform1fv", | 7472 "glUniform1fv", |
7473 Program::kUniform1f, | 7473 Program::kUniform1f, |
7474 &real_location, | 7474 &real_location, |
7475 &type, | 7475 &type, |
7476 &count)) { | 7476 &count)) { |
7477 return; | 7477 return; |
7478 } | 7478 } |
7479 if (type == GL_BOOL) { | 7479 if (type == GL_BOOL) { |
7480 scoped_ptr<GLint[]> temp(new GLint[count]); | 7480 std::unique_ptr<GLint[]> temp(new GLint[count]); |
7481 for (GLsizei ii = 0; ii < count; ++ii) { | 7481 for (GLsizei ii = 0; ii < count; ++ii) { |
7482 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7482 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7483 } | 7483 } |
7484 glUniform1iv(real_location, count, temp.get()); | 7484 glUniform1iv(real_location, count, temp.get()); |
7485 } else { | 7485 } else { |
7486 glUniform1fv(real_location, count, value); | 7486 glUniform1fv(real_location, count, value); |
7487 } | 7487 } |
7488 } | 7488 } |
7489 | 7489 |
7490 void GLES2DecoderImpl::DoUniform2fv( | 7490 void GLES2DecoderImpl::DoUniform2fv( |
7491 GLint fake_location, GLsizei count, const GLfloat* value) { | 7491 GLint fake_location, GLsizei count, const GLfloat* value) { |
7492 GLenum type = 0; | 7492 GLenum type = 0; |
7493 GLint real_location = -1; | 7493 GLint real_location = -1; |
7494 if (!PrepForSetUniformByLocation(fake_location, | 7494 if (!PrepForSetUniformByLocation(fake_location, |
7495 "glUniform2fv", | 7495 "glUniform2fv", |
7496 Program::kUniform2f, | 7496 Program::kUniform2f, |
7497 &real_location, | 7497 &real_location, |
7498 &type, | 7498 &type, |
7499 &count)) { | 7499 &count)) { |
7500 return; | 7500 return; |
7501 } | 7501 } |
7502 if (type == GL_BOOL_VEC2) { | 7502 if (type == GL_BOOL_VEC2) { |
7503 GLsizei num_values = count * 2; | 7503 GLsizei num_values = count * 2; |
7504 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 7504 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
7505 for (GLsizei ii = 0; ii < num_values; ++ii) { | 7505 for (GLsizei ii = 0; ii < num_values; ++ii) { |
7506 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7506 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7507 } | 7507 } |
7508 glUniform2iv(real_location, count, temp.get()); | 7508 glUniform2iv(real_location, count, temp.get()); |
7509 } else { | 7509 } else { |
7510 glUniform2fv(real_location, count, value); | 7510 glUniform2fv(real_location, count, value); |
7511 } | 7511 } |
7512 } | 7512 } |
7513 | 7513 |
7514 void GLES2DecoderImpl::DoUniform3fv( | 7514 void GLES2DecoderImpl::DoUniform3fv( |
7515 GLint fake_location, GLsizei count, const GLfloat* value) { | 7515 GLint fake_location, GLsizei count, const GLfloat* value) { |
7516 GLenum type = 0; | 7516 GLenum type = 0; |
7517 GLint real_location = -1; | 7517 GLint real_location = -1; |
7518 if (!PrepForSetUniformByLocation(fake_location, | 7518 if (!PrepForSetUniformByLocation(fake_location, |
7519 "glUniform3fv", | 7519 "glUniform3fv", |
7520 Program::kUniform3f, | 7520 Program::kUniform3f, |
7521 &real_location, | 7521 &real_location, |
7522 &type, | 7522 &type, |
7523 &count)) { | 7523 &count)) { |
7524 return; | 7524 return; |
7525 } | 7525 } |
7526 if (type == GL_BOOL_VEC3) { | 7526 if (type == GL_BOOL_VEC3) { |
7527 GLsizei num_values = count * 3; | 7527 GLsizei num_values = count * 3; |
7528 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 7528 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
7529 for (GLsizei ii = 0; ii < num_values; ++ii) { | 7529 for (GLsizei ii = 0; ii < num_values; ++ii) { |
7530 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7530 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7531 } | 7531 } |
7532 glUniform3iv(real_location, count, temp.get()); | 7532 glUniform3iv(real_location, count, temp.get()); |
7533 } else { | 7533 } else { |
7534 glUniform3fv(real_location, count, value); | 7534 glUniform3fv(real_location, count, value); |
7535 } | 7535 } |
7536 } | 7536 } |
7537 | 7537 |
7538 void GLES2DecoderImpl::DoUniform4fv( | 7538 void GLES2DecoderImpl::DoUniform4fv( |
7539 GLint fake_location, GLsizei count, const GLfloat* value) { | 7539 GLint fake_location, GLsizei count, const GLfloat* value) { |
7540 GLenum type = 0; | 7540 GLenum type = 0; |
7541 GLint real_location = -1; | 7541 GLint real_location = -1; |
7542 if (!PrepForSetUniformByLocation(fake_location, | 7542 if (!PrepForSetUniformByLocation(fake_location, |
7543 "glUniform4fv", | 7543 "glUniform4fv", |
7544 Program::kUniform4f, | 7544 Program::kUniform4f, |
7545 &real_location, | 7545 &real_location, |
7546 &type, | 7546 &type, |
7547 &count)) { | 7547 &count)) { |
7548 return; | 7548 return; |
7549 } | 7549 } |
7550 if (type == GL_BOOL_VEC4) { | 7550 if (type == GL_BOOL_VEC4) { |
7551 GLsizei num_values = count * 4; | 7551 GLsizei num_values = count * 4; |
7552 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 7552 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
7553 for (GLsizei ii = 0; ii < num_values; ++ii) { | 7553 for (GLsizei ii = 0; ii < num_values; ++ii) { |
7554 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7554 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7555 } | 7555 } |
7556 glUniform4iv(real_location, count, temp.get()); | 7556 glUniform4iv(real_location, count, temp.get()); |
7557 } else { | 7557 } else { |
7558 glUniform4fv(real_location, count, value); | 7558 glUniform4fv(real_location, count, value); |
7559 } | 7559 } |
7560 } | 7560 } |
7561 | 7561 |
7562 void GLES2DecoderImpl::DoUniform2iv( | 7562 void GLES2DecoderImpl::DoUniform2iv( |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8271 LOCAL_SET_GL_ERROR( | 8271 LOCAL_SET_GL_ERROR( |
8272 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); | 8272 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); |
8273 return false; | 8273 return false; |
8274 } | 8274 } |
8275 if (attrib_info && | 8275 if (attrib_info && |
8276 attrib->CanAccess(max_accessed) && | 8276 attrib->CanAccess(max_accessed) && |
8277 attrib->type() == GL_FIXED) { | 8277 attrib->type() == GL_FIXED) { |
8278 int num_elements = attrib->size() * num_vertices; | 8278 int num_elements = attrib->size() * num_vertices; |
8279 const int src_size = num_elements * sizeof(int32_t); | 8279 const int src_size = num_elements * sizeof(int32_t); |
8280 const int dst_size = num_elements * sizeof(float); | 8280 const int dst_size = num_elements * sizeof(float); |
8281 scoped_ptr<float[]> data(new float[num_elements]); | 8281 std::unique_ptr<float[]> data(new float[num_elements]); |
8282 const int32_t* src = reinterpret_cast<const int32_t*>( | 8282 const int32_t* src = reinterpret_cast<const int32_t*>( |
8283 attrib->buffer()->GetRange(attrib->offset(), src_size)); | 8283 attrib->buffer()->GetRange(attrib->offset(), src_size)); |
8284 const int32_t* end = src + num_elements; | 8284 const int32_t* end = src + num_elements; |
8285 float* dst = data.get(); | 8285 float* dst = data.get(); |
8286 while (src != end) { | 8286 while (src != end) { |
8287 *dst++ = static_cast<float>(*src++) / 65536.0f; | 8287 *dst++ = static_cast<float>(*src++) / 65536.0f; |
8288 } | 8288 } |
8289 glBufferSubData(GL_ARRAY_BUFFER, offset, dst_size, data.get()); | 8289 glBufferSubData(GL_ARRAY_BUFFER, offset, dst_size, data.get()); |
8290 glVertexAttribPointer( | 8290 glVertexAttribPointer( |
8291 attrib->index(), attrib->size(), GL_FLOAT, false, 0, | 8291 attrib->index(), attrib->size(), GL_FLOAT, false, 0, |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9674 int32_t max_y; | 9674 int32_t max_y; |
9675 if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y)) { | 9675 if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y)) { |
9676 LOCAL_SET_GL_ERROR( | 9676 LOCAL_SET_GL_ERROR( |
9677 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); | 9677 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); |
9678 return error::kNoError; | 9678 return error::kNoError; |
9679 } | 9679 } |
9680 | 9680 |
9681 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glReadPixels"); | 9681 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glReadPixels"); |
9682 | 9682 |
9683 ScopedResolvedFrameBufferBinder binder(this, false, true); | 9683 ScopedResolvedFrameBufferBinder binder(this, false, true); |
9684 scoped_ptr<ScopedFrameBufferReadPixelHelper> helper; | 9684 std::unique_ptr<ScopedFrameBufferReadPixelHelper> helper; |
9685 if (NeedsIOSurfaceReadbackWorkaround()) | 9685 if (NeedsIOSurfaceReadbackWorkaround()) |
9686 helper.reset(new ScopedFrameBufferReadPixelHelper(&state_, this)); | 9686 helper.reset(new ScopedFrameBufferReadPixelHelper(&state_, this)); |
9687 | 9687 |
9688 gfx::Rect rect(x, y, width, height); // Safe before we checked above. | 9688 gfx::Rect rect(x, y, width, height); // Safe before we checked above. |
9689 gfx::Rect max_rect(max_size); | 9689 gfx::Rect max_rect(max_size); |
9690 if (!max_rect.Contains(rect)) { | 9690 if (!max_rect.Contains(rect)) { |
9691 rect.Intersect(max_rect); | 9691 rect.Intersect(max_rect); |
9692 if (!rect.IsEmpty()) { | 9692 if (!rect.IsEmpty()) { |
9693 if (y < 0) { | 9693 if (y < 0) { |
9694 pixels += static_cast<uint32_t>(-y) * padded_row_size;; | 9694 pixels += static_cast<uint32_t>(-y) * padded_row_size;; |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10473 if (!GLES2Util::ComputeImageDataSizes( | 10473 if (!GLES2Util::ComputeImageDataSizes( |
10474 width, tile_height, 1, format, type, state_.unpack_alignment, &size, | 10474 width, tile_height, 1, format, type, state_.unpack_alignment, &size, |
10475 NULL, NULL)) { | 10475 NULL, NULL)) { |
10476 return false; | 10476 return false; |
10477 } | 10477 } |
10478 } else { | 10478 } else { |
10479 tile_height = height; | 10479 tile_height = height; |
10480 } | 10480 } |
10481 | 10481 |
10482 // Assumes the size has already been checked. | 10482 // Assumes the size has already been checked. |
10483 scoped_ptr<char[]> zero(new char[size]); | 10483 std::unique_ptr<char[]> zero(new char[size]); |
10484 memset(zero.get(), 0, size); | 10484 memset(zero.get(), 0, size); |
10485 glBindTexture(texture->target(), texture->service_id()); | 10485 glBindTexture(texture->target(), texture->service_id()); |
10486 | 10486 |
10487 GLint y = 0; | 10487 GLint y = 0; |
10488 while (y < height) { | 10488 while (y < height) { |
10489 GLint h = y + tile_height > height ? height - y : tile_height; | 10489 GLint h = y + tile_height > height ? height - y : tile_height; |
10490 glTexSubImage2D(target, level, xoffset, yoffset + y, width, h, format, type, | 10490 glTexSubImage2D(target, level, xoffset, yoffset + y, width, h, format, type, |
10491 zero.get()); | 10491 zero.get()); |
10492 y += tile_height; | 10492 y += tile_height; |
10493 } | 10493 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10585 | 10585 |
10586 TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearLevel3D", "size", size); | 10586 TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearLevel3D", "size", size); |
10587 | 10587 |
10588 GLuint buffer_id = 0; | 10588 GLuint buffer_id = 0; |
10589 glGenBuffersARB(1, &buffer_id); | 10589 glGenBuffersARB(1, &buffer_id); |
10590 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer_id); | 10590 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer_id); |
10591 { | 10591 { |
10592 // Include padding as some drivers incorrectly requires padding for the | 10592 // Include padding as some drivers incorrectly requires padding for the |
10593 // last row. | 10593 // last row. |
10594 buffer_size += padding; | 10594 buffer_size += padding; |
10595 scoped_ptr<char[]> zero(new char[buffer_size]); | 10595 std::unique_ptr<char[]> zero(new char[buffer_size]); |
10596 memset(zero.get(), 0, buffer_size); | 10596 memset(zero.get(), 0, buffer_size); |
10597 // TODO(zmo): Consider glMapBufferRange instead. | 10597 // TODO(zmo): Consider glMapBufferRange instead. |
10598 glBufferData( | 10598 glBufferData( |
10599 GL_PIXEL_UNPACK_BUFFER, buffer_size, zero.get(), GL_STATIC_DRAW); | 10599 GL_PIXEL_UNPACK_BUFFER, buffer_size, zero.get(), GL_STATIC_DRAW); |
10600 } | 10600 } |
10601 | 10601 |
10602 Buffer* bound_buffer = buffer_manager()->GetBufferInfoForTarget( | 10602 Buffer* bound_buffer = buffer_manager()->GetBufferInfoForTarget( |
10603 &state_, GL_PIXEL_UNPACK_BUFFER); | 10603 &state_, GL_PIXEL_UNPACK_BUFFER); |
10604 if (bound_buffer) { | 10604 if (bound_buffer) { |
10605 // If an unpack buffer is bound, we need to clear unpack parameters | 10605 // If an unpack buffer is bound, we need to clear unpack parameters |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11095 if (!EnsureGPUMemoryAvailable(image_size)) { | 11095 if (!EnsureGPUMemoryAvailable(image_size)) { |
11096 LOCAL_SET_GL_ERROR( | 11096 LOCAL_SET_GL_ERROR( |
11097 GL_OUT_OF_MEMORY, "glCompressedTexImage2D", "out of memory"); | 11097 GL_OUT_OF_MEMORY, "glCompressedTexImage2D", "out of memory"); |
11098 return error::kNoError; | 11098 return error::kNoError; |
11099 } | 11099 } |
11100 | 11100 |
11101 if (texture->IsAttachedToFramebuffer()) { | 11101 if (texture->IsAttachedToFramebuffer()) { |
11102 framebuffer_state_.clear_state_dirty = true; | 11102 framebuffer_state_.clear_state_dirty = true; |
11103 } | 11103 } |
11104 | 11104 |
11105 scoped_ptr<int8_t[]> zero; | 11105 std::unique_ptr<int8_t[]> zero; |
11106 if (!data) { | 11106 if (!data) { |
11107 zero.reset(new int8_t[image_size]); | 11107 zero.reset(new int8_t[image_size]); |
11108 memset(zero.get(), 0, image_size); | 11108 memset(zero.get(), 0, image_size); |
11109 data = zero.get(); | 11109 data = zero.get(); |
11110 } | 11110 } |
11111 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage2D"); | 11111 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage2D"); |
11112 glCompressedTexImage2D( | 11112 glCompressedTexImage2D( |
11113 target, level, internal_format, width, height, border, image_size, data); | 11113 target, level, internal_format, width, height, border, image_size, data); |
11114 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D"); | 11114 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D"); |
11115 if (error == GL_NO_ERROR) { | 11115 if (error == GL_NO_ERROR) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11290 if (!EnsureGPUMemoryAvailable(image_size)) { | 11290 if (!EnsureGPUMemoryAvailable(image_size)) { |
11291 LOCAL_SET_GL_ERROR( | 11291 LOCAL_SET_GL_ERROR( |
11292 GL_OUT_OF_MEMORY, "glCompressedTexImage3D", "out of memory"); | 11292 GL_OUT_OF_MEMORY, "glCompressedTexImage3D", "out of memory"); |
11293 return error::kNoError; | 11293 return error::kNoError; |
11294 } | 11294 } |
11295 | 11295 |
11296 if (texture->IsAttachedToFramebuffer()) { | 11296 if (texture->IsAttachedToFramebuffer()) { |
11297 framebuffer_state_.clear_state_dirty = true; | 11297 framebuffer_state_.clear_state_dirty = true; |
11298 } | 11298 } |
11299 | 11299 |
11300 scoped_ptr<int8_t[]> zero; | 11300 std::unique_ptr<int8_t[]> zero; |
11301 if (!data) { | 11301 if (!data) { |
11302 zero.reset(new int8_t[image_size]); | 11302 zero.reset(new int8_t[image_size]); |
11303 memset(zero.get(), 0, image_size); | 11303 memset(zero.get(), 0, image_size); |
11304 data = zero.get(); | 11304 data = zero.get(); |
11305 } | 11305 } |
11306 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage3D"); | 11306 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage3D"); |
11307 glCompressedTexImage3D(target, level, internal_format, width, height, depth, | 11307 glCompressedTexImage3D(target, level, internal_format, width, height, depth, |
11308 border, image_size, data); | 11308 border, image_size, data); |
11309 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage3D"); | 11309 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage3D"); |
11310 if (error == GL_NO_ERROR) { | 11310 if (error == GL_NO_ERROR) { |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11856 GLint copyWidth = 0; | 11856 GLint copyWidth = 0; |
11857 GLint copyHeight = 0; | 11857 GLint copyHeight = 0; |
11858 Clip(x, width, size.width(), ©X, ©Width); | 11858 Clip(x, width, size.width(), ©X, ©Width); |
11859 Clip(y, height, size.height(), ©Y, ©Height); | 11859 Clip(y, height, size.height(), ©Y, ©Height); |
11860 | 11860 |
11861 if (copyX != x || | 11861 if (copyX != x || |
11862 copyY != y || | 11862 copyY != y || |
11863 copyWidth != width || | 11863 copyWidth != width || |
11864 copyHeight != height) { | 11864 copyHeight != height) { |
11865 // some part was clipped so clear the rect. | 11865 // some part was clipped so clear the rect. |
11866 scoped_ptr<char[]> zero(new char[pixels_size]); | 11866 std::unique_ptr<char[]> zero(new char[pixels_size]); |
11867 memset(zero.get(), 0, pixels_size); | 11867 memset(zero.get(), 0, pixels_size); |
11868 glTexImage2D(target, level, | 11868 glTexImage2D(target, level, |
11869 texture_manager()->AdjustTexInternalFormat(internal_format), | 11869 texture_manager()->AdjustTexInternalFormat(internal_format), |
11870 width, height, border, format, type, zero.get()); | 11870 width, height, border, format, type, zero.get()); |
11871 if (copyHeight > 0 && copyWidth > 0) { | 11871 if (copyHeight > 0 && copyWidth > 0) { |
11872 GLint dx = copyX - x; | 11872 GLint dx = copyX - x; |
11873 GLint dy = copyY - y; | 11873 GLint dy = copyY - y; |
11874 GLint destX = dx; | 11874 GLint destX = dx; |
11875 GLint destY = dy; | 11875 GLint destY = dy; |
11876 glCopyTexSubImage2D(target, level, | 11876 glCopyTexSubImage2D(target, level, |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12378 cmds::GetUniformfv::Result* result; | 12378 cmds::GetUniformfv::Result* result; |
12379 GLenum result_type; | 12379 GLenum result_type; |
12380 GLsizei result_size; | 12380 GLsizei result_size; |
12381 if (GetUniformSetup<GLfloat>(program, fake_location, c.params_shm_id, | 12381 if (GetUniformSetup<GLfloat>(program, fake_location, c.params_shm_id, |
12382 c.params_shm_offset, &error, &real_location, | 12382 c.params_shm_offset, &error, &real_location, |
12383 &service_id, &result, &result_type, | 12383 &service_id, &result, &result_type, |
12384 &result_size)) { | 12384 &result_size)) { |
12385 if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || | 12385 if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || |
12386 result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { | 12386 result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { |
12387 GLsizei num_values = result_size / sizeof(GLfloat); | 12387 GLsizei num_values = result_size / sizeof(GLfloat); |
12388 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 12388 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
12389 glGetUniformiv(service_id, real_location, temp.get()); | 12389 glGetUniformiv(service_id, real_location, temp.get()); |
12390 GLfloat* dst = result->GetData(); | 12390 GLfloat* dst = result->GetData(); |
12391 for (GLsizei ii = 0; ii < num_values; ++ii) { | 12391 for (GLsizei ii = 0; ii < num_values; ++ii) { |
12392 dst[ii] = (temp[ii] != 0); | 12392 dst[ii] = (temp[ii] != 0); |
12393 } | 12393 } |
12394 } else { | 12394 } else { |
12395 glGetUniformfv(service_id, real_location, result->GetData()); | 12395 glGetUniformfv(service_id, real_location, result->GetData()); |
12396 } | 12396 } |
12397 } | 12397 } |
12398 return error; | 12398 return error; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12739 return error::kOutOfBounds; | 12739 return error::kOutOfBounds; |
12740 } | 12740 } |
12741 const GLuint* shaders = GetSharedMemoryAs<const GLuint*>( | 12741 const GLuint* shaders = GetSharedMemoryAs<const GLuint*>( |
12742 c.shaders_shm_id, c.shaders_shm_offset, data_size); | 12742 c.shaders_shm_id, c.shaders_shm_offset, data_size); |
12743 GLenum binaryformat = static_cast<GLenum>(c.binaryformat); | 12743 GLenum binaryformat = static_cast<GLenum>(c.binaryformat); |
12744 const void* binary = GetSharedMemoryAs<const void*>( | 12744 const void* binary = GetSharedMemoryAs<const void*>( |
12745 c.binary_shm_id, c.binary_shm_offset, length); | 12745 c.binary_shm_id, c.binary_shm_offset, length); |
12746 if (shaders == NULL || binary == NULL) { | 12746 if (shaders == NULL || binary == NULL) { |
12747 return error::kOutOfBounds; | 12747 return error::kOutOfBounds; |
12748 } | 12748 } |
12749 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 12749 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
12750 for (GLsizei ii = 0; ii < n; ++ii) { | 12750 for (GLsizei ii = 0; ii < n; ++ii) { |
12751 Shader* shader = GetShader(shaders[ii]); | 12751 Shader* shader = GetShader(shaders[ii]); |
12752 if (!shader) { | 12752 if (!shader) { |
12753 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "unknown shader"); | 12753 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "unknown shader"); |
12754 return error::kNoError; | 12754 return error::kNoError; |
12755 } | 12755 } |
12756 service_ids[ii] = shader->service_id(); | 12756 service_ids[ii] = shader->service_id(); |
12757 } | 12757 } |
12758 // TODO(gman): call glShaderBinary | 12758 // TODO(gman): call glShaderBinary |
12759 return error::kNoError; | 12759 return error::kNoError; |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13578 return false; | 13578 return false; |
13579 } | 13579 } |
13580 } | 13580 } |
13581 | 13581 |
13582 if (!features().native_vertex_array_object) { | 13582 if (!features().native_vertex_array_object) { |
13583 // Emulated VAO | 13583 // Emulated VAO |
13584 for (GLsizei ii = 0; ii < n; ++ii) { | 13584 for (GLsizei ii = 0; ii < n; ++ii) { |
13585 CreateVertexAttribManager(client_ids[ii], 0, true); | 13585 CreateVertexAttribManager(client_ids[ii], 0, true); |
13586 } | 13586 } |
13587 } else { | 13587 } else { |
13588 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 13588 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
13589 | 13589 |
13590 glGenVertexArraysOES(n, service_ids.get()); | 13590 glGenVertexArraysOES(n, service_ids.get()); |
13591 for (GLsizei ii = 0; ii < n; ++ii) { | 13591 for (GLsizei ii = 0; ii < n; ++ii) { |
13592 CreateVertexAttribManager(client_ids[ii], service_ids[ii], true); | 13592 CreateVertexAttribManager(client_ids[ii], service_ids[ii], true); |
13593 } | 13593 } |
13594 } | 13594 } |
13595 | 13595 |
13596 return true; | 13596 return true; |
13597 } | 13597 } |
13598 | 13598 |
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15482 transform_type, "transformType"); | 15482 transform_type, "transformType"); |
15483 return false; | 15483 return false; |
15484 } | 15484 } |
15485 *out_transform_type = transform_type; | 15485 *out_transform_type = transform_type; |
15486 return true; | 15486 return true; |
15487 } | 15487 } |
15488 template <typename Cmd> | 15488 template <typename Cmd> |
15489 bool GetPathNameData(const Cmd& cmd, | 15489 bool GetPathNameData(const Cmd& cmd, |
15490 GLuint num_paths, | 15490 GLuint num_paths, |
15491 GLenum path_name_type, | 15491 GLenum path_name_type, |
15492 scoped_ptr<GLuint[]>* out_buffer) { | 15492 std::unique_ptr<GLuint[]>* out_buffer) { |
15493 DCHECK(validators_->path_name_type.IsValid(path_name_type)); | 15493 DCHECK(validators_->path_name_type.IsValid(path_name_type)); |
15494 GLuint path_base = static_cast<GLuint>(cmd.pathBase); | 15494 GLuint path_base = static_cast<GLuint>(cmd.pathBase); |
15495 uint32_t shm_id = static_cast<uint32_t>(cmd.paths_shm_id); | 15495 uint32_t shm_id = static_cast<uint32_t>(cmd.paths_shm_id); |
15496 uint32_t shm_offset = static_cast<uint32_t>(cmd.paths_shm_offset); | 15496 uint32_t shm_offset = static_cast<uint32_t>(cmd.paths_shm_offset); |
15497 if (shm_id == 0 && shm_offset == 0) { | 15497 if (shm_id == 0 && shm_offset == 0) { |
15498 error_ = error::kOutOfBounds; | 15498 error_ = error::kOutOfBounds; |
15499 return false; | 15499 return false; |
15500 } | 15500 } |
15501 switch (path_name_type) { | 15501 switch (path_name_type) { |
15502 case GL_BYTE: | 15502 case GL_BYTE: |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15569 *out_cover_mode = cover_mode; | 15569 *out_cover_mode = cover_mode; |
15570 return true; | 15570 return true; |
15571 } | 15571 } |
15572 | 15572 |
15573 private: | 15573 private: |
15574 template <typename T> | 15574 template <typename T> |
15575 bool GetPathNameDataImpl(GLuint num_paths, | 15575 bool GetPathNameDataImpl(GLuint num_paths, |
15576 GLuint path_base, | 15576 GLuint path_base, |
15577 uint32_t shm_id, | 15577 uint32_t shm_id, |
15578 uint32_t shm_offset, | 15578 uint32_t shm_offset, |
15579 scoped_ptr<GLuint[]>* out_buffer) { | 15579 std::unique_ptr<GLuint[]>* out_buffer) { |
15580 uint32_t paths_size = 0; | 15580 uint32_t paths_size = 0; |
15581 if (!SafeMultiplyUint32(num_paths, sizeof(T), &paths_size)) { | 15581 if (!SafeMultiplyUint32(num_paths, sizeof(T), &paths_size)) { |
15582 error_ = error::kOutOfBounds; | 15582 error_ = error::kOutOfBounds; |
15583 return false; | 15583 return false; |
15584 } | 15584 } |
15585 T* paths = decoder_->GetSharedMemoryAs<T*>(shm_id, shm_offset, paths_size); | 15585 T* paths = decoder_->GetSharedMemoryAs<T*>(shm_id, shm_offset, paths_size); |
15586 if (!paths) { | 15586 if (!paths) { |
15587 error_ = error::kOutOfBounds; | 15587 error_ = error::kOutOfBounds; |
15588 return false; | 15588 return false; |
15589 } | 15589 } |
15590 scoped_ptr<GLuint[]> result_paths(new GLuint[num_paths]); | 15590 std::unique_ptr<GLuint[]> result_paths(new GLuint[num_paths]); |
15591 bool has_paths = false; | 15591 bool has_paths = false; |
15592 for (GLuint i = 0; i < num_paths; ++i) { | 15592 for (GLuint i = 0; i < num_paths; ++i) { |
15593 GLuint service_id = 0; | 15593 GLuint service_id = 0; |
15594 // The below addition is ok even with over- and underflows. | 15594 // The below addition is ok even with over- and underflows. |
15595 // There is no difference if client passes: | 15595 // There is no difference if client passes: |
15596 // * base==4, T=GLbyte, paths[0]==0xfa (-6) | 15596 // * base==4, T=GLbyte, paths[0]==0xfa (-6) |
15597 // * base==0xffffffff, T=GLuint, paths[0]==0xffffffff | 15597 // * base==0xffffffff, T=GLuint, paths[0]==0xffffffff |
15598 // * base==0, T=GLuint, paths[0]==0xfffffffe | 15598 // * base==0, T=GLuint, paths[0]==0xfffffffe |
15599 // For the all the cases, the interpretation is that | 15599 // For the all the cases, the interpretation is that |
15600 // client intends to use the path 0xfffffffe. | 15600 // client intends to use the path 0xfffffffe. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15695 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCoords < 0"); | 15695 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCoords < 0"); |
15696 return error::kNoError; | 15696 return error::kNoError; |
15697 } | 15697 } |
15698 | 15698 |
15699 GLenum coord_type = static_cast<uint32_t>(c.coordType); | 15699 GLenum coord_type = static_cast<uint32_t>(c.coordType); |
15700 if (!validators_->path_coord_type.IsValid(static_cast<GLint>(coord_type))) { | 15700 if (!validators_->path_coord_type.IsValid(static_cast<GLint>(coord_type))) { |
15701 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName, "invalid coordType"); | 15701 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName, "invalid coordType"); |
15702 return error::kNoError; | 15702 return error::kNoError; |
15703 } | 15703 } |
15704 | 15704 |
15705 scoped_ptr<GLubyte[]> commands; | 15705 std::unique_ptr<GLubyte[]> commands; |
15706 base::CheckedNumeric<GLsizei> num_coords_expected = 0; | 15706 base::CheckedNumeric<GLsizei> num_coords_expected = 0; |
15707 | 15707 |
15708 if (num_commands > 0) { | 15708 if (num_commands > 0) { |
15709 uint32_t commands_shm_id = static_cast<uint32_t>(c.commands_shm_id); | 15709 uint32_t commands_shm_id = static_cast<uint32_t>(c.commands_shm_id); |
15710 uint32_t commands_shm_offset = static_cast<uint32_t>(c.commands_shm_offset); | 15710 uint32_t commands_shm_offset = static_cast<uint32_t>(c.commands_shm_offset); |
15711 if (commands_shm_id != 0 || commands_shm_offset != 0) { | 15711 if (commands_shm_id != 0 || commands_shm_offset != 0) { |
15712 const GLubyte* shared_commands = GetSharedMemoryAs<const GLubyte*>( | 15712 const GLubyte* shared_commands = GetSharedMemoryAs<const GLubyte*>( |
15713 commands_shm_id, commands_shm_offset, num_commands); | 15713 commands_shm_id, commands_shm_offset, num_commands); |
15714 if (shared_commands) { | 15714 if (shared_commands) { |
15715 commands.reset(new GLubyte[num_commands]); | 15715 commands.reset(new GLubyte[num_commands]); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16033 GLuint mask = 0; | 16033 GLuint mask = 0; |
16034 GLenum transform_type = GL_NONE; | 16034 GLenum transform_type = GL_NONE; |
16035 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 16035 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
16036 !v.GetFillModeAndMask(c, &fill_mode, &mask) || | 16036 !v.GetFillModeAndMask(c, &fill_mode, &mask) || |
16037 !v.GetTransformType(c, &transform_type)) | 16037 !v.GetTransformType(c, &transform_type)) |
16038 return v.error(); | 16038 return v.error(); |
16039 | 16039 |
16040 if (num_paths == 0) | 16040 if (num_paths == 0) |
16041 return error::kNoError; | 16041 return error::kNoError; |
16042 | 16042 |
16043 scoped_ptr<GLuint[]> paths; | 16043 std::unique_ptr<GLuint[]> paths; |
16044 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16044 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16045 return v.error(); | 16045 return v.error(); |
16046 | 16046 |
16047 const GLfloat* transforms = nullptr; | 16047 const GLfloat* transforms = nullptr; |
16048 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16048 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16049 return v.error(); | 16049 return v.error(); |
16050 | 16050 |
16051 ApplyDirtyState(); | 16051 ApplyDirtyState(); |
16052 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, | 16052 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, |
16053 fill_mode, mask, transform_type, transforms); | 16053 fill_mode, mask, transform_type, transforms); |
(...skipping 13 matching lines...) Expand all Loading... |
16067 GLuint num_paths = 0; | 16067 GLuint num_paths = 0; |
16068 GLenum path_name_type = GL_NONE; | 16068 GLenum path_name_type = GL_NONE; |
16069 GLenum transform_type = GL_NONE; | 16069 GLenum transform_type = GL_NONE; |
16070 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 16070 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
16071 !v.GetTransformType(c, &transform_type)) | 16071 !v.GetTransformType(c, &transform_type)) |
16072 return v.error(); | 16072 return v.error(); |
16073 | 16073 |
16074 if (num_paths == 0) | 16074 if (num_paths == 0) |
16075 return error::kNoError; | 16075 return error::kNoError; |
16076 | 16076 |
16077 scoped_ptr<GLuint[]> paths; | 16077 std::unique_ptr<GLuint[]> paths; |
16078 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16078 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16079 return v.error(); | 16079 return v.error(); |
16080 | 16080 |
16081 const GLfloat* transforms = nullptr; | 16081 const GLfloat* transforms = nullptr; |
16082 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16082 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16083 return v.error(); | 16083 return v.error(); |
16084 | 16084 |
16085 GLint reference = static_cast<GLint>(c.reference); | 16085 GLint reference = static_cast<GLint>(c.reference); |
16086 GLuint mask = static_cast<GLuint>(c.mask); | 16086 GLuint mask = static_cast<GLuint>(c.mask); |
16087 ApplyDirtyState(); | 16087 ApplyDirtyState(); |
(...skipping 17 matching lines...) Expand all Loading... |
16105 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; | 16105 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; |
16106 GLenum transform_type = GL_NONE; | 16106 GLenum transform_type = GL_NONE; |
16107 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 16107 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
16108 !v.GetCoverMode(c, &cover_mode) || | 16108 !v.GetCoverMode(c, &cover_mode) || |
16109 !v.GetTransformType(c, &transform_type)) | 16109 !v.GetTransformType(c, &transform_type)) |
16110 return v.error(); | 16110 return v.error(); |
16111 | 16111 |
16112 if (num_paths == 0) | 16112 if (num_paths == 0) |
16113 return error::kNoError; | 16113 return error::kNoError; |
16114 | 16114 |
16115 scoped_ptr<GLuint[]> paths; | 16115 std::unique_ptr<GLuint[]> paths; |
16116 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16116 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16117 return v.error(); | 16117 return v.error(); |
16118 | 16118 |
16119 const GLfloat* transforms = nullptr; | 16119 const GLfloat* transforms = nullptr; |
16120 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16120 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16121 return v.error(); | 16121 return v.error(); |
16122 | 16122 |
16123 ApplyDirtyState(); | 16123 ApplyDirtyState(); |
16124 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, | 16124 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, |
16125 cover_mode, transform_type, transforms); | 16125 cover_mode, transform_type, transforms); |
(...skipping 15 matching lines...) Expand all Loading... |
16141 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; | 16141 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; |
16142 GLenum transform_type = GL_NONE; | 16142 GLenum transform_type = GL_NONE; |
16143 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 16143 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
16144 !v.GetCoverMode(c, &cover_mode) || | 16144 !v.GetCoverMode(c, &cover_mode) || |
16145 !v.GetTransformType(c, &transform_type)) | 16145 !v.GetTransformType(c, &transform_type)) |
16146 return v.error(); | 16146 return v.error(); |
16147 | 16147 |
16148 if (num_paths == 0) | 16148 if (num_paths == 0) |
16149 return error::kNoError; | 16149 return error::kNoError; |
16150 | 16150 |
16151 scoped_ptr<GLuint[]> paths; | 16151 std::unique_ptr<GLuint[]> paths; |
16152 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16152 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16153 return v.error(); | 16153 return v.error(); |
16154 | 16154 |
16155 const GLfloat* transforms = nullptr; | 16155 const GLfloat* transforms = nullptr; |
16156 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16156 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16157 return v.error(); | 16157 return v.error(); |
16158 | 16158 |
16159 ApplyDirtyState(); | 16159 ApplyDirtyState(); |
16160 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, | 16160 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, |
16161 cover_mode, transform_type, transforms); | 16161 cover_mode, transform_type, transforms); |
(...skipping 19 matching lines...) Expand all Loading... |
16181 GLenum transform_type = GL_NONE; | 16181 GLenum transform_type = GL_NONE; |
16182 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 16182 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
16183 !v.GetFillModeAndMask(c, &fill_mode, &mask) || | 16183 !v.GetFillModeAndMask(c, &fill_mode, &mask) || |
16184 !v.GetCoverMode(c, &cover_mode) || | 16184 !v.GetCoverMode(c, &cover_mode) || |
16185 !v.GetTransformType(c, &transform_type)) | 16185 !v.GetTransformType(c, &transform_type)) |
16186 return v.error(); | 16186 return v.error(); |
16187 | 16187 |
16188 if (num_paths == 0) | 16188 if (num_paths == 0) |
16189 return error::kNoError; | 16189 return error::kNoError; |
16190 | 16190 |
16191 scoped_ptr<GLuint[]> paths; | 16191 std::unique_ptr<GLuint[]> paths; |
16192 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16192 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16193 return v.error(); | 16193 return v.error(); |
16194 | 16194 |
16195 const GLfloat* transforms = nullptr; | 16195 const GLfloat* transforms = nullptr; |
16196 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16196 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16197 return v.error(); | 16197 return v.error(); |
16198 | 16198 |
16199 ApplyDirtyState(); | 16199 ApplyDirtyState(); |
16200 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), | 16200 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), |
16201 0, fill_mode, mask, cover_mode, | 16201 0, fill_mode, mask, cover_mode, |
(...skipping 18 matching lines...) Expand all Loading... |
16220 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; | 16220 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; |
16221 GLenum transform_type = GL_NONE; | 16221 GLenum transform_type = GL_NONE; |
16222 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 16222 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
16223 !v.GetCoverMode(c, &cover_mode) || | 16223 !v.GetCoverMode(c, &cover_mode) || |
16224 !v.GetTransformType(c, &transform_type)) | 16224 !v.GetTransformType(c, &transform_type)) |
16225 return v.error(); | 16225 return v.error(); |
16226 | 16226 |
16227 if (num_paths == 0) | 16227 if (num_paths == 0) |
16228 return error::kNoError; | 16228 return error::kNoError; |
16229 | 16229 |
16230 scoped_ptr<GLuint[]> paths; | 16230 std::unique_ptr<GLuint[]> paths; |
16231 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16231 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16232 return v.error(); | 16232 return v.error(); |
16233 | 16233 |
16234 const GLfloat* transforms = nullptr; | 16234 const GLfloat* transforms = nullptr; |
16235 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16235 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16236 return v.error(); | 16236 return v.error(); |
16237 | 16237 |
16238 GLint reference = static_cast<GLint>(c.reference); | 16238 GLint reference = static_cast<GLint>(c.reference); |
16239 GLuint mask = static_cast<GLuint>(c.mask); | 16239 GLuint mask = static_cast<GLuint>(c.mask); |
16240 ApplyDirtyState(); | 16240 ApplyDirtyState(); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16512 } | 16512 } |
16513 | 16513 |
16514 // Include the auto-generated part of this file. We split this because it means | 16514 // Include the auto-generated part of this file. We split this because it means |
16515 // we can easily edit the non-auto generated parts right here in this file | 16515 // we can easily edit the non-auto generated parts right here in this file |
16516 // instead of having to edit some template or the code generator. | 16516 // instead of having to edit some template or the code generator. |
16517 #include "base/macros.h" | 16517 #include "base/macros.h" |
16518 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16518 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
16519 | 16519 |
16520 } // namespace gles2 | 16520 } // namespace gles2 |
16521 } // namespace gpu | 16521 } // namespace gpu |
OLD | NEW |