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 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 // The buffer used to simulate GL_FIXED attribs. | 1988 // The buffer used to simulate GL_FIXED attribs. |
1989 GLuint fixed_attrib_buffer_id_; | 1989 GLuint fixed_attrib_buffer_id_; |
1990 | 1990 |
1991 // The size of fiixed attrib buffer. | 1991 // The size of fiixed attrib buffer. |
1992 GLsizei fixed_attrib_buffer_size_; | 1992 GLsizei fixed_attrib_buffer_size_; |
1993 | 1993 |
1994 // The offscreen frame buffer that the client renders to. With EGL, the | 1994 // The offscreen frame buffer that the client renders to. With EGL, the |
1995 // depth and stencil buffers are separate. With regular GL there is a single | 1995 // depth and stencil buffers are separate. With regular GL there is a single |
1996 // packed depth stencil buffer in offscreen_target_depth_render_buffer_. | 1996 // packed depth stencil buffer in offscreen_target_depth_render_buffer_. |
1997 // offscreen_target_stencil_render_buffer_ is unused. | 1997 // offscreen_target_stencil_render_buffer_ is unused. |
1998 scoped_ptr<BackFramebuffer> offscreen_target_frame_buffer_; | 1998 std::unique_ptr<BackFramebuffer> offscreen_target_frame_buffer_; |
1999 scoped_ptr<BackTexture> offscreen_target_color_texture_; | 1999 std::unique_ptr<BackTexture> offscreen_target_color_texture_; |
2000 scoped_ptr<BackRenderbuffer> offscreen_target_color_render_buffer_; | 2000 std::unique_ptr<BackRenderbuffer> offscreen_target_color_render_buffer_; |
2001 scoped_ptr<BackRenderbuffer> offscreen_target_depth_render_buffer_; | 2001 std::unique_ptr<BackRenderbuffer> offscreen_target_depth_render_buffer_; |
2002 scoped_ptr<BackRenderbuffer> offscreen_target_stencil_render_buffer_; | 2002 std::unique_ptr<BackRenderbuffer> offscreen_target_stencil_render_buffer_; |
2003 GLenum offscreen_target_color_format_; | 2003 GLenum offscreen_target_color_format_; |
2004 GLenum offscreen_target_depth_format_; | 2004 GLenum offscreen_target_depth_format_; |
2005 GLenum offscreen_target_stencil_format_; | 2005 GLenum offscreen_target_stencil_format_; |
2006 GLsizei offscreen_target_samples_; | 2006 GLsizei offscreen_target_samples_; |
2007 GLboolean offscreen_target_buffer_preserved_; | 2007 GLboolean offscreen_target_buffer_preserved_; |
2008 | 2008 |
2009 // The copy that is saved when SwapBuffers is called. | 2009 // The copy that is saved when SwapBuffers is called. |
2010 scoped_ptr<BackFramebuffer> offscreen_saved_frame_buffer_; | 2010 std::unique_ptr<BackFramebuffer> offscreen_saved_frame_buffer_; |
2011 scoped_ptr<BackTexture> offscreen_saved_color_texture_; | 2011 std::unique_ptr<BackTexture> offscreen_saved_color_texture_; |
2012 scoped_refptr<TextureRef> | 2012 scoped_refptr<TextureRef> |
2013 offscreen_saved_color_texture_info_; | 2013 offscreen_saved_color_texture_info_; |
2014 | 2014 |
2015 // The copy that is used as the destination for multi-sample resolves. | 2015 // The copy that is used as the destination for multi-sample resolves. |
2016 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; | 2016 std::unique_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; |
2017 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; | 2017 std::unique_ptr<BackTexture> offscreen_resolved_color_texture_; |
2018 GLenum offscreen_saved_color_format_; | 2018 GLenum offscreen_saved_color_format_; |
2019 | 2019 |
2020 scoped_ptr<QueryManager> query_manager_; | 2020 std::unique_ptr<QueryManager> query_manager_; |
2021 | 2021 |
2022 scoped_ptr<VertexArrayManager> vertex_array_manager_; | 2022 std::unique_ptr<VertexArrayManager> vertex_array_manager_; |
2023 | 2023 |
2024 scoped_ptr<ImageManager> image_manager_; | 2024 std::unique_ptr<ImageManager> image_manager_; |
2025 | 2025 |
2026 FenceSyncReleaseCallback fence_sync_release_callback_; | 2026 FenceSyncReleaseCallback fence_sync_release_callback_; |
2027 WaitFenceSyncCallback wait_fence_sync_callback_; | 2027 WaitFenceSyncCallback wait_fence_sync_callback_; |
2028 | 2028 |
2029 ShaderCacheCallback shader_cache_callback_; | 2029 ShaderCacheCallback shader_cache_callback_; |
2030 | 2030 |
2031 // The format of the back buffer_ | 2031 // The format of the back buffer_ |
2032 GLenum back_buffer_color_format_; | 2032 GLenum back_buffer_color_format_; |
2033 bool back_buffer_has_depth_; | 2033 bool back_buffer_has_depth_; |
2034 bool back_buffer_has_stencil_; | 2034 bool back_buffer_has_stencil_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 bool lose_context_when_out_of_memory_; | 2090 bool lose_context_when_out_of_memory_; |
2091 | 2091 |
2092 // Log extra info. | 2092 // Log extra info. |
2093 bool service_logging_; | 2093 bool service_logging_; |
2094 | 2094 |
2095 #if defined(OS_MACOSX) | 2095 #if defined(OS_MACOSX) |
2096 typedef std::map<GLuint, IOSurfaceRef> TextureToIOSurfaceMap; | 2096 typedef std::map<GLuint, IOSurfaceRef> TextureToIOSurfaceMap; |
2097 TextureToIOSurfaceMap texture_to_io_surface_map_; | 2097 TextureToIOSurfaceMap texture_to_io_surface_map_; |
2098 #endif | 2098 #endif |
2099 | 2099 |
2100 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | 2100 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
2101 scoped_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; | 2101 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; |
2102 | 2102 |
2103 // Cached values of the currently assigned viewport dimensions. | 2103 // Cached values of the currently assigned viewport dimensions. |
2104 GLsizei viewport_max_width_; | 2104 GLsizei viewport_max_width_; |
2105 GLsizei viewport_max_height_; | 2105 GLsizei viewport_max_height_; |
2106 | 2106 |
2107 // Command buffer stats. | 2107 // Command buffer stats. |
2108 base::TimeDelta total_processing_commands_time_; | 2108 base::TimeDelta total_processing_commands_time_; |
2109 | 2109 |
2110 // States related to each manager. | 2110 // States related to each manager. |
2111 DecoderTextureState texture_state_; | 2111 DecoderTextureState texture_state_; |
2112 DecoderFramebufferState framebuffer_state_; | 2112 DecoderFramebufferState framebuffer_state_; |
2113 | 2113 |
2114 scoped_ptr<GPUTracer> gpu_tracer_; | 2114 std::unique_ptr<GPUTracer> gpu_tracer_; |
2115 scoped_ptr<GPUStateTracer> gpu_state_tracer_; | 2115 std::unique_ptr<GPUStateTracer> gpu_state_tracer_; |
2116 const unsigned char* gpu_decoder_category_; | 2116 const unsigned char* gpu_decoder_category_; |
2117 int gpu_trace_level_; | 2117 int gpu_trace_level_; |
2118 bool gpu_trace_commands_; | 2118 bool gpu_trace_commands_; |
2119 bool gpu_debug_commands_; | 2119 bool gpu_debug_commands_; |
2120 | 2120 |
2121 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; | 2121 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; |
2122 | 2122 |
2123 // Used to validate multisample renderbuffers if needed | 2123 // Used to validate multisample renderbuffers if needed |
2124 GLuint validation_texture_; | 2124 GLuint validation_texture_; |
2125 GLuint validation_fbo_multisample_; | 2125 GLuint validation_fbo_multisample_; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2394 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); | 2394 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); |
2395 uint32_t image_size = 0; | 2395 uint32_t image_size = 0; |
2396 GLES2Util::ComputeImageDataSizes( | 2396 GLES2Util::ComputeImageDataSizes( |
2397 size.width(), size.height(), 1, format, GL_UNSIGNED_BYTE, 8, &image_size, | 2397 size.width(), size.height(), 1, format, GL_UNSIGNED_BYTE, 8, &image_size, |
2398 NULL, NULL); | 2398 NULL, NULL); |
2399 | 2399 |
2400 if (!memory_tracker_.EnsureGPUMemoryAvailable(image_size)) { | 2400 if (!memory_tracker_.EnsureGPUMemoryAvailable(image_size)) { |
2401 return false; | 2401 return false; |
2402 } | 2402 } |
2403 | 2403 |
2404 scoped_ptr<char[]> zero_data; | 2404 std::unique_ptr<char[]> zero_data; |
2405 if (zero) { | 2405 if (zero) { |
2406 zero_data.reset(new char[image_size]); | 2406 zero_data.reset(new char[image_size]); |
2407 memset(zero_data.get(), 0, image_size); | 2407 memset(zero_data.get(), 0, image_size); |
2408 } | 2408 } |
2409 | 2409 |
2410 glTexImage2D(GL_TEXTURE_2D, | 2410 glTexImage2D(GL_TEXTURE_2D, |
2411 0, // mip level | 2411 0, // mip level |
2412 format, | 2412 format, |
2413 size.width(), | 2413 size.width(), |
2414 size.height(), | 2414 size.height(), |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3418 } | 3418 } |
3419 return true; | 3419 return true; |
3420 } | 3420 } |
3421 | 3421 |
3422 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { | 3422 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { |
3423 for (GLsizei ii = 0; ii < n; ++ii) { | 3423 for (GLsizei ii = 0; ii < n; ++ii) { |
3424 if (GetBuffer(client_ids[ii])) { | 3424 if (GetBuffer(client_ids[ii])) { |
3425 return false; | 3425 return false; |
3426 } | 3426 } |
3427 } | 3427 } |
3428 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3428 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3429 glGenBuffersARB(n, service_ids.get()); | 3429 glGenBuffersARB(n, service_ids.get()); |
3430 for (GLsizei ii = 0; ii < n; ++ii) { | 3430 for (GLsizei ii = 0; ii < n; ++ii) { |
3431 CreateBuffer(client_ids[ii], service_ids[ii]); | 3431 CreateBuffer(client_ids[ii], service_ids[ii]); |
3432 } | 3432 } |
3433 return true; | 3433 return true; |
3434 } | 3434 } |
3435 | 3435 |
3436 bool GLES2DecoderImpl::GenFramebuffersHelper( | 3436 bool GLES2DecoderImpl::GenFramebuffersHelper( |
3437 GLsizei n, const GLuint* client_ids) { | 3437 GLsizei n, const GLuint* client_ids) { |
3438 for (GLsizei ii = 0; ii < n; ++ii) { | 3438 for (GLsizei ii = 0; ii < n; ++ii) { |
3439 if (GetFramebuffer(client_ids[ii])) { | 3439 if (GetFramebuffer(client_ids[ii])) { |
3440 return false; | 3440 return false; |
3441 } | 3441 } |
3442 } | 3442 } |
3443 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3443 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3444 glGenFramebuffersEXT(n, service_ids.get()); | 3444 glGenFramebuffersEXT(n, service_ids.get()); |
3445 for (GLsizei ii = 0; ii < n; ++ii) { | 3445 for (GLsizei ii = 0; ii < n; ++ii) { |
3446 CreateFramebuffer(client_ids[ii], service_ids[ii]); | 3446 CreateFramebuffer(client_ids[ii], service_ids[ii]); |
3447 } | 3447 } |
3448 return true; | 3448 return true; |
3449 } | 3449 } |
3450 | 3450 |
3451 bool GLES2DecoderImpl::GenRenderbuffersHelper( | 3451 bool GLES2DecoderImpl::GenRenderbuffersHelper( |
3452 GLsizei n, const GLuint* client_ids) { | 3452 GLsizei n, const GLuint* client_ids) { |
3453 for (GLsizei ii = 0; ii < n; ++ii) { | 3453 for (GLsizei ii = 0; ii < n; ++ii) { |
3454 if (GetRenderbuffer(client_ids[ii])) { | 3454 if (GetRenderbuffer(client_ids[ii])) { |
3455 return false; | 3455 return false; |
3456 } | 3456 } |
3457 } | 3457 } |
3458 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3458 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3459 glGenRenderbuffersEXT(n, service_ids.get()); | 3459 glGenRenderbuffersEXT(n, service_ids.get()); |
3460 for (GLsizei ii = 0; ii < n; ++ii) { | 3460 for (GLsizei ii = 0; ii < n; ++ii) { |
3461 CreateRenderbuffer(client_ids[ii], service_ids[ii]); | 3461 CreateRenderbuffer(client_ids[ii], service_ids[ii]); |
3462 } | 3462 } |
3463 return true; | 3463 return true; |
3464 } | 3464 } |
3465 | 3465 |
3466 bool GLES2DecoderImpl::GenValuebuffersCHROMIUMHelper(GLsizei n, | 3466 bool GLES2DecoderImpl::GenValuebuffersCHROMIUMHelper(GLsizei n, |
3467 const GLuint* client_ids) { | 3467 const GLuint* client_ids) { |
3468 for (GLsizei ii = 0; ii < n; ++ii) { | 3468 for (GLsizei ii = 0; ii < n; ++ii) { |
3469 if (GetValuebuffer(client_ids[ii])) { | 3469 if (GetValuebuffer(client_ids[ii])) { |
3470 return false; | 3470 return false; |
3471 } | 3471 } |
3472 } | 3472 } |
3473 for (GLsizei ii = 0; ii < n; ++ii) { | 3473 for (GLsizei ii = 0; ii < n; ++ii) { |
3474 CreateValuebuffer(client_ids[ii]); | 3474 CreateValuebuffer(client_ids[ii]); |
3475 } | 3475 } |
3476 return true; | 3476 return true; |
3477 } | 3477 } |
3478 | 3478 |
3479 bool GLES2DecoderImpl::GenTexturesHelper(GLsizei n, const GLuint* client_ids) { | 3479 bool GLES2DecoderImpl::GenTexturesHelper(GLsizei n, const GLuint* client_ids) { |
3480 for (GLsizei ii = 0; ii < n; ++ii) { | 3480 for (GLsizei ii = 0; ii < n; ++ii) { |
3481 if (GetTexture(client_ids[ii])) { | 3481 if (GetTexture(client_ids[ii])) { |
3482 return false; | 3482 return false; |
3483 } | 3483 } |
3484 } | 3484 } |
3485 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3485 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3486 glGenTextures(n, service_ids.get()); | 3486 glGenTextures(n, service_ids.get()); |
3487 for (GLsizei ii = 0; ii < n; ++ii) { | 3487 for (GLsizei ii = 0; ii < n; ++ii) { |
3488 CreateTexture(client_ids[ii], service_ids[ii]); | 3488 CreateTexture(client_ids[ii], service_ids[ii]); |
3489 } | 3489 } |
3490 return true; | 3490 return true; |
3491 } | 3491 } |
3492 | 3492 |
3493 bool GLES2DecoderImpl::GenSamplersHelper(GLsizei n, const GLuint* client_ids) { | 3493 bool GLES2DecoderImpl::GenSamplersHelper(GLsizei n, const GLuint* client_ids) { |
3494 for (GLsizei ii = 0; ii < n; ++ii) { | 3494 for (GLsizei ii = 0; ii < n; ++ii) { |
3495 if (GetSampler(client_ids[ii])) { | 3495 if (GetSampler(client_ids[ii])) { |
3496 return false; | 3496 return false; |
3497 } | 3497 } |
3498 } | 3498 } |
3499 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3499 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3500 glGenSamplers(n, service_ids.get()); | 3500 glGenSamplers(n, service_ids.get()); |
3501 for (GLsizei ii = 0; ii < n; ++ii) { | 3501 for (GLsizei ii = 0; ii < n; ++ii) { |
3502 CreateSampler(client_ids[ii], service_ids[ii]); | 3502 CreateSampler(client_ids[ii], service_ids[ii]); |
3503 } | 3503 } |
3504 return true; | 3504 return true; |
3505 } | 3505 } |
3506 | 3506 |
3507 bool GLES2DecoderImpl::GenPathsCHROMIUMHelper(GLuint first_client_id, | 3507 bool GLES2DecoderImpl::GenPathsCHROMIUMHelper(GLuint first_client_id, |
3508 GLsizei range) { | 3508 GLsizei range) { |
3509 GLuint last_client_id; | 3509 GLuint last_client_id; |
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5090 default: | 5090 default: |
5091 NOTREACHED(); | 5091 NOTREACHED(); |
5092 break; | 5092 break; |
5093 } | 5093 } |
5094 } | 5094 } |
5095 } | 5095 } |
5096 | 5096 |
5097 // If the default framebuffer is bound but we are still rendering to an | 5097 // If the default framebuffer is bound but we are still rendering to an |
5098 // FBO, translate attachment names that refer to default framebuffer | 5098 // FBO, translate attachment names that refer to default framebuffer |
5099 // channels to corresponding framebuffer attachments. | 5099 // channels to corresponding framebuffer attachments. |
5100 scoped_ptr<GLenum[]> translated_attachments(new GLenum[numAttachments]); | 5100 std::unique_ptr<GLenum[]> translated_attachments(new GLenum[numAttachments]); |
5101 for (GLsizei i = 0; i < numAttachments; ++i) { | 5101 for (GLsizei i = 0; i < numAttachments; ++i) { |
5102 GLenum attachment = attachments[i]; | 5102 GLenum attachment = attachments[i]; |
5103 if (!framebuffer && GetBackbufferServiceId()) { | 5103 if (!framebuffer && GetBackbufferServiceId()) { |
5104 switch (attachment) { | 5104 switch (attachment) { |
5105 case GL_COLOR_EXT: | 5105 case GL_COLOR_EXT: |
5106 attachment = GL_COLOR_ATTACHMENT0; | 5106 attachment = GL_COLOR_ATTACHMENT0; |
5107 break; | 5107 break; |
5108 case GL_DEPTH_EXT: | 5108 case GL_DEPTH_EXT: |
5109 attachment = GL_DEPTH_ATTACHMENT; | 5109 attachment = GL_DEPTH_ATTACHMENT; |
5110 break; | 5110 break; |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5696 feature_info_->gl_version_info().is_desktop_core_profile) { | 5696 feature_info_->gl_version_info().is_desktop_core_profile) { |
5697 return GL_POINT_SIZE_RANGE; | 5697 return GL_POINT_SIZE_RANGE; |
5698 } | 5698 } |
5699 return pname; | 5699 return pname; |
5700 } | 5700 } |
5701 | 5701 |
5702 void GLES2DecoderImpl::DoGetBooleanv(GLenum pname, GLboolean* params) { | 5702 void GLES2DecoderImpl::DoGetBooleanv(GLenum pname, GLboolean* params) { |
5703 DCHECK(params); | 5703 DCHECK(params); |
5704 GLsizei num_written = 0; | 5704 GLsizei num_written = 0; |
5705 if (GetNumValuesReturnedForGLGet(pname, &num_written)) { | 5705 if (GetNumValuesReturnedForGLGet(pname, &num_written)) { |
5706 scoped_ptr<GLint[]> values(new GLint[num_written]); | 5706 std::unique_ptr<GLint[]> values(new GLint[num_written]); |
5707 if (!state_.GetStateAsGLint(pname, values.get(), &num_written)) { | 5707 if (!state_.GetStateAsGLint(pname, values.get(), &num_written)) { |
5708 GetHelper(pname, values.get(), &num_written); | 5708 GetHelper(pname, values.get(), &num_written); |
5709 } | 5709 } |
5710 for (GLsizei ii = 0; ii < num_written; ++ii) { | 5710 for (GLsizei ii = 0; ii < num_written; ++ii) { |
5711 params[ii] = static_cast<GLboolean>(values[ii]); | 5711 params[ii] = static_cast<GLboolean>(values[ii]); |
5712 } | 5712 } |
5713 } else { | 5713 } else { |
5714 pname = AdjustGetPname(pname); | 5714 pname = AdjustGetPname(pname); |
5715 glGetBooleanv(pname, params); | 5715 glGetBooleanv(pname, params); |
5716 } | 5716 } |
5717 } | 5717 } |
5718 | 5718 |
5719 void GLES2DecoderImpl::DoGetFloatv(GLenum pname, GLfloat* params) { | 5719 void GLES2DecoderImpl::DoGetFloatv(GLenum pname, GLfloat* params) { |
5720 DCHECK(params); | 5720 DCHECK(params); |
5721 GLsizei num_written = 0; | 5721 GLsizei num_written = 0; |
5722 if (!state_.GetStateAsGLfloat(pname, params, &num_written)) { | 5722 if (!state_.GetStateAsGLfloat(pname, params, &num_written)) { |
5723 if (GetHelper(pname, NULL, &num_written)) { | 5723 if (GetHelper(pname, NULL, &num_written)) { |
5724 scoped_ptr<GLint[]> values(new GLint[num_written]); | 5724 std::unique_ptr<GLint[]> values(new GLint[num_written]); |
5725 GetHelper(pname, values.get(), &num_written); | 5725 GetHelper(pname, values.get(), &num_written); |
5726 for (GLsizei ii = 0; ii < num_written; ++ii) { | 5726 for (GLsizei ii = 0; ii < num_written; ++ii) { |
5727 params[ii] = static_cast<GLfloat>(values[ii]); | 5727 params[ii] = static_cast<GLfloat>(values[ii]); |
5728 } | 5728 } |
5729 } else { | 5729 } else { |
5730 pname = AdjustGetPname(pname); | 5730 pname = AdjustGetPname(pname); |
5731 glGetFloatv(pname, params); | 5731 glGetFloatv(pname, params); |
5732 } | 5732 } |
5733 } | 5733 } |
5734 } | 5734 } |
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7378 GLint real_location = -1; | 7378 GLint real_location = -1; |
7379 if (!PrepForSetUniformByLocation(fake_location, | 7379 if (!PrepForSetUniformByLocation(fake_location, |
7380 "glUniform1fv", | 7380 "glUniform1fv", |
7381 Program::kUniform1f, | 7381 Program::kUniform1f, |
7382 &real_location, | 7382 &real_location, |
7383 &type, | 7383 &type, |
7384 &count)) { | 7384 &count)) { |
7385 return; | 7385 return; |
7386 } | 7386 } |
7387 if (type == GL_BOOL) { | 7387 if (type == GL_BOOL) { |
7388 scoped_ptr<GLint[]> temp(new GLint[count]); | 7388 std::unique_ptr<GLint[]> temp(new GLint[count]); |
7389 for (GLsizei ii = 0; ii < count; ++ii) { | 7389 for (GLsizei ii = 0; ii < count; ++ii) { |
7390 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7390 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7391 } | 7391 } |
7392 glUniform1iv(real_location, count, temp.get()); | 7392 glUniform1iv(real_location, count, temp.get()); |
7393 } else { | 7393 } else { |
7394 glUniform1fv(real_location, count, value); | 7394 glUniform1fv(real_location, count, value); |
7395 } | 7395 } |
7396 } | 7396 } |
7397 | 7397 |
7398 void GLES2DecoderImpl::DoUniform2fv( | 7398 void GLES2DecoderImpl::DoUniform2fv( |
7399 GLint fake_location, GLsizei count, const GLfloat* value) { | 7399 GLint fake_location, GLsizei count, const GLfloat* value) { |
7400 GLenum type = 0; | 7400 GLenum type = 0; |
7401 GLint real_location = -1; | 7401 GLint real_location = -1; |
7402 if (!PrepForSetUniformByLocation(fake_location, | 7402 if (!PrepForSetUniformByLocation(fake_location, |
7403 "glUniform2fv", | 7403 "glUniform2fv", |
7404 Program::kUniform2f, | 7404 Program::kUniform2f, |
7405 &real_location, | 7405 &real_location, |
7406 &type, | 7406 &type, |
7407 &count)) { | 7407 &count)) { |
7408 return; | 7408 return; |
7409 } | 7409 } |
7410 if (type == GL_BOOL_VEC2) { | 7410 if (type == GL_BOOL_VEC2) { |
7411 GLsizei num_values = count * 2; | 7411 GLsizei num_values = count * 2; |
7412 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 7412 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
7413 for (GLsizei ii = 0; ii < num_values; ++ii) { | 7413 for (GLsizei ii = 0; ii < num_values; ++ii) { |
7414 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7414 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7415 } | 7415 } |
7416 glUniform2iv(real_location, count, temp.get()); | 7416 glUniform2iv(real_location, count, temp.get()); |
7417 } else { | 7417 } else { |
7418 glUniform2fv(real_location, count, value); | 7418 glUniform2fv(real_location, count, value); |
7419 } | 7419 } |
7420 } | 7420 } |
7421 | 7421 |
7422 void GLES2DecoderImpl::DoUniform3fv( | 7422 void GLES2DecoderImpl::DoUniform3fv( |
7423 GLint fake_location, GLsizei count, const GLfloat* value) { | 7423 GLint fake_location, GLsizei count, const GLfloat* value) { |
7424 GLenum type = 0; | 7424 GLenum type = 0; |
7425 GLint real_location = -1; | 7425 GLint real_location = -1; |
7426 if (!PrepForSetUniformByLocation(fake_location, | 7426 if (!PrepForSetUniformByLocation(fake_location, |
7427 "glUniform3fv", | 7427 "glUniform3fv", |
7428 Program::kUniform3f, | 7428 Program::kUniform3f, |
7429 &real_location, | 7429 &real_location, |
7430 &type, | 7430 &type, |
7431 &count)) { | 7431 &count)) { |
7432 return; | 7432 return; |
7433 } | 7433 } |
7434 if (type == GL_BOOL_VEC3) { | 7434 if (type == GL_BOOL_VEC3) { |
7435 GLsizei num_values = count * 3; | 7435 GLsizei num_values = count * 3; |
7436 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 7436 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
7437 for (GLsizei ii = 0; ii < num_values; ++ii) { | 7437 for (GLsizei ii = 0; ii < num_values; ++ii) { |
7438 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7438 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7439 } | 7439 } |
7440 glUniform3iv(real_location, count, temp.get()); | 7440 glUniform3iv(real_location, count, temp.get()); |
7441 } else { | 7441 } else { |
7442 glUniform3fv(real_location, count, value); | 7442 glUniform3fv(real_location, count, value); |
7443 } | 7443 } |
7444 } | 7444 } |
7445 | 7445 |
7446 void GLES2DecoderImpl::DoUniform4fv( | 7446 void GLES2DecoderImpl::DoUniform4fv( |
7447 GLint fake_location, GLsizei count, const GLfloat* value) { | 7447 GLint fake_location, GLsizei count, const GLfloat* value) { |
7448 GLenum type = 0; | 7448 GLenum type = 0; |
7449 GLint real_location = -1; | 7449 GLint real_location = -1; |
7450 if (!PrepForSetUniformByLocation(fake_location, | 7450 if (!PrepForSetUniformByLocation(fake_location, |
7451 "glUniform4fv", | 7451 "glUniform4fv", |
7452 Program::kUniform4f, | 7452 Program::kUniform4f, |
7453 &real_location, | 7453 &real_location, |
7454 &type, | 7454 &type, |
7455 &count)) { | 7455 &count)) { |
7456 return; | 7456 return; |
7457 } | 7457 } |
7458 if (type == GL_BOOL_VEC4) { | 7458 if (type == GL_BOOL_VEC4) { |
7459 GLsizei num_values = count * 4; | 7459 GLsizei num_values = count * 4; |
7460 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 7460 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
7461 for (GLsizei ii = 0; ii < num_values; ++ii) { | 7461 for (GLsizei ii = 0; ii < num_values; ++ii) { |
7462 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7462 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7463 } | 7463 } |
7464 glUniform4iv(real_location, count, temp.get()); | 7464 glUniform4iv(real_location, count, temp.get()); |
7465 } else { | 7465 } else { |
7466 glUniform4fv(real_location, count, value); | 7466 glUniform4fv(real_location, count, value); |
7467 } | 7467 } |
7468 } | 7468 } |
7469 | 7469 |
7470 void GLES2DecoderImpl::DoUniform2iv( | 7470 void GLES2DecoderImpl::DoUniform2iv( |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8179 LOCAL_SET_GL_ERROR( | 8179 LOCAL_SET_GL_ERROR( |
8180 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); | 8180 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); |
8181 return false; | 8181 return false; |
8182 } | 8182 } |
8183 if (attrib_info && | 8183 if (attrib_info && |
8184 attrib->CanAccess(max_accessed) && | 8184 attrib->CanAccess(max_accessed) && |
8185 attrib->type() == GL_FIXED) { | 8185 attrib->type() == GL_FIXED) { |
8186 int num_elements = attrib->size() * num_vertices; | 8186 int num_elements = attrib->size() * num_vertices; |
8187 const int src_size = num_elements * sizeof(int32_t); | 8187 const int src_size = num_elements * sizeof(int32_t); |
8188 const int dst_size = num_elements * sizeof(float); | 8188 const int dst_size = num_elements * sizeof(float); |
8189 scoped_ptr<float[]> data(new float[num_elements]); | 8189 std::unique_ptr<float[]> data(new float[num_elements]); |
8190 const int32_t* src = reinterpret_cast<const int32_t*>( | 8190 const int32_t* src = reinterpret_cast<const int32_t*>( |
8191 attrib->buffer()->GetRange(attrib->offset(), src_size)); | 8191 attrib->buffer()->GetRange(attrib->offset(), src_size)); |
8192 const int32_t* end = src + num_elements; | 8192 const int32_t* end = src + num_elements; |
8193 float* dst = data.get(); | 8193 float* dst = data.get(); |
8194 while (src != end) { | 8194 while (src != end) { |
8195 *dst++ = static_cast<float>(*src++) / 65536.0f; | 8195 *dst++ = static_cast<float>(*src++) / 65536.0f; |
8196 } | 8196 } |
8197 glBufferSubData(GL_ARRAY_BUFFER, offset, dst_size, data.get()); | 8197 glBufferSubData(GL_ARRAY_BUFFER, offset, dst_size, data.get()); |
8198 glVertexAttribPointer( | 8198 glVertexAttribPointer( |
8199 attrib->index(), attrib->size(), GL_FLOAT, false, 0, | 8199 attrib->index(), attrib->size(), GL_FLOAT, false, 0, |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9567 int32_t max_y; | 9567 int32_t max_y; |
9568 if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y)) { | 9568 if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y)) { |
9569 LOCAL_SET_GL_ERROR( | 9569 LOCAL_SET_GL_ERROR( |
9570 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); | 9570 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); |
9571 return error::kNoError; | 9571 return error::kNoError; |
9572 } | 9572 } |
9573 | 9573 |
9574 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glReadPixels"); | 9574 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glReadPixels"); |
9575 | 9575 |
9576 ScopedResolvedFrameBufferBinder binder(this, false, true); | 9576 ScopedResolvedFrameBufferBinder binder(this, false, true); |
9577 scoped_ptr<ScopedFrameBufferReadPixelHelper> helper; | 9577 std::unique_ptr<ScopedFrameBufferReadPixelHelper> helper; |
9578 if (NeedsIOSurfaceReadbackWorkaround()) | 9578 if (NeedsIOSurfaceReadbackWorkaround()) |
9579 helper.reset(new ScopedFrameBufferReadPixelHelper(&state_, this)); | 9579 helper.reset(new ScopedFrameBufferReadPixelHelper(&state_, this)); |
9580 | 9580 |
9581 gfx::Rect rect(x, y, width, height); // Safe before we checked above. | 9581 gfx::Rect rect(x, y, width, height); // Safe before we checked above. |
9582 gfx::Rect max_rect(max_size); | 9582 gfx::Rect max_rect(max_size); |
9583 if (!max_rect.Contains(rect)) { | 9583 if (!max_rect.Contains(rect)) { |
9584 rect.Intersect(max_rect); | 9584 rect.Intersect(max_rect); |
9585 if (!rect.IsEmpty()) { | 9585 if (!rect.IsEmpty()) { |
9586 if (y < 0) { | 9586 if (y < 0) { |
9587 pixels += static_cast<uint32_t>(-y) * padded_row_size;; | 9587 pixels += static_cast<uint32_t>(-y) * padded_row_size;; |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10366 if (!GLES2Util::ComputeImageDataSizes( | 10366 if (!GLES2Util::ComputeImageDataSizes( |
10367 width, tile_height, 1, format, type, state_.unpack_alignment, &size, | 10367 width, tile_height, 1, format, type, state_.unpack_alignment, &size, |
10368 NULL, NULL)) { | 10368 NULL, NULL)) { |
10369 return false; | 10369 return false; |
10370 } | 10370 } |
10371 } else { | 10371 } else { |
10372 tile_height = height; | 10372 tile_height = height; |
10373 } | 10373 } |
10374 | 10374 |
10375 // Assumes the size has already been checked. | 10375 // Assumes the size has already been checked. |
10376 scoped_ptr<char[]> zero(new char[size]); | 10376 std::unique_ptr<char[]> zero(new char[size]); |
10377 memset(zero.get(), 0, size); | 10377 memset(zero.get(), 0, size); |
10378 glBindTexture(texture->target(), texture->service_id()); | 10378 glBindTexture(texture->target(), texture->service_id()); |
10379 | 10379 |
10380 GLint y = 0; | 10380 GLint y = 0; |
10381 while (y < height) { | 10381 while (y < height) { |
10382 GLint h = y + tile_height > height ? height - y : tile_height; | 10382 GLint h = y + tile_height > height ? height - y : tile_height; |
10383 glTexSubImage2D(target, level, xoffset, yoffset + y, width, h, format, type, | 10383 glTexSubImage2D(target, level, xoffset, yoffset + y, width, h, format, type, |
10384 zero.get()); | 10384 zero.get()); |
10385 y += tile_height; | 10385 y += tile_height; |
10386 } | 10386 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10478 | 10478 |
10479 TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearLevel3D", "size", size); | 10479 TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearLevel3D", "size", size); |
10480 | 10480 |
10481 GLuint buffer_id = 0; | 10481 GLuint buffer_id = 0; |
10482 glGenBuffersARB(1, &buffer_id); | 10482 glGenBuffersARB(1, &buffer_id); |
10483 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer_id); | 10483 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer_id); |
10484 { | 10484 { |
10485 // Include padding as some drivers incorrectly requires padding for the | 10485 // Include padding as some drivers incorrectly requires padding for the |
10486 // last row. | 10486 // last row. |
10487 buffer_size += padding; | 10487 buffer_size += padding; |
10488 scoped_ptr<char[]> zero(new char[buffer_size]); | 10488 std::unique_ptr<char[]> zero(new char[buffer_size]); |
10489 memset(zero.get(), 0, buffer_size); | 10489 memset(zero.get(), 0, buffer_size); |
10490 // TODO(zmo): Consider glMapBufferRange instead. | 10490 // TODO(zmo): Consider glMapBufferRange instead. |
10491 glBufferData( | 10491 glBufferData( |
10492 GL_PIXEL_UNPACK_BUFFER, buffer_size, zero.get(), GL_STATIC_DRAW); | 10492 GL_PIXEL_UNPACK_BUFFER, buffer_size, zero.get(), GL_STATIC_DRAW); |
10493 } | 10493 } |
10494 | 10494 |
10495 Buffer* bound_buffer = buffer_manager()->GetBufferInfoForTarget( | 10495 Buffer* bound_buffer = buffer_manager()->GetBufferInfoForTarget( |
10496 &state_, GL_PIXEL_UNPACK_BUFFER); | 10496 &state_, GL_PIXEL_UNPACK_BUFFER); |
10497 if (bound_buffer) { | 10497 if (bound_buffer) { |
10498 // If an unpack buffer is bound, we need to clear unpack parameters | 10498 // 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... |
10988 if (!EnsureGPUMemoryAvailable(image_size)) { | 10988 if (!EnsureGPUMemoryAvailable(image_size)) { |
10989 LOCAL_SET_GL_ERROR( | 10989 LOCAL_SET_GL_ERROR( |
10990 GL_OUT_OF_MEMORY, "glCompressedTexImage2D", "out of memory"); | 10990 GL_OUT_OF_MEMORY, "glCompressedTexImage2D", "out of memory"); |
10991 return error::kNoError; | 10991 return error::kNoError; |
10992 } | 10992 } |
10993 | 10993 |
10994 if (texture->IsAttachedToFramebuffer()) { | 10994 if (texture->IsAttachedToFramebuffer()) { |
10995 framebuffer_state_.clear_state_dirty = true; | 10995 framebuffer_state_.clear_state_dirty = true; |
10996 } | 10996 } |
10997 | 10997 |
10998 scoped_ptr<int8_t[]> zero; | 10998 std::unique_ptr<int8_t[]> zero; |
10999 if (!data) { | 10999 if (!data) { |
11000 zero.reset(new int8_t[image_size]); | 11000 zero.reset(new int8_t[image_size]); |
11001 memset(zero.get(), 0, image_size); | 11001 memset(zero.get(), 0, image_size); |
11002 data = zero.get(); | 11002 data = zero.get(); |
11003 } | 11003 } |
11004 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage2D"); | 11004 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage2D"); |
11005 glCompressedTexImage2D( | 11005 glCompressedTexImage2D( |
11006 target, level, internal_format, width, height, border, image_size, data); | 11006 target, level, internal_format, width, height, border, image_size, data); |
11007 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D"); | 11007 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D"); |
11008 if (error == GL_NO_ERROR) { | 11008 if (error == GL_NO_ERROR) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11183 if (!EnsureGPUMemoryAvailable(image_size)) { | 11183 if (!EnsureGPUMemoryAvailable(image_size)) { |
11184 LOCAL_SET_GL_ERROR( | 11184 LOCAL_SET_GL_ERROR( |
11185 GL_OUT_OF_MEMORY, "glCompressedTexImage3D", "out of memory"); | 11185 GL_OUT_OF_MEMORY, "glCompressedTexImage3D", "out of memory"); |
11186 return error::kNoError; | 11186 return error::kNoError; |
11187 } | 11187 } |
11188 | 11188 |
11189 if (texture->IsAttachedToFramebuffer()) { | 11189 if (texture->IsAttachedToFramebuffer()) { |
11190 framebuffer_state_.clear_state_dirty = true; | 11190 framebuffer_state_.clear_state_dirty = true; |
11191 } | 11191 } |
11192 | 11192 |
11193 scoped_ptr<int8_t[]> zero; | 11193 std::unique_ptr<int8_t[]> zero; |
11194 if (!data) { | 11194 if (!data) { |
11195 zero.reset(new int8_t[image_size]); | 11195 zero.reset(new int8_t[image_size]); |
11196 memset(zero.get(), 0, image_size); | 11196 memset(zero.get(), 0, image_size); |
11197 data = zero.get(); | 11197 data = zero.get(); |
11198 } | 11198 } |
11199 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage3D"); | 11199 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage3D"); |
11200 glCompressedTexImage3D(target, level, internal_format, width, height, depth, | 11200 glCompressedTexImage3D(target, level, internal_format, width, height, depth, |
11201 border, image_size, data); | 11201 border, image_size, data); |
11202 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage3D"); | 11202 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage3D"); |
11203 if (error == GL_NO_ERROR) { | 11203 if (error == GL_NO_ERROR) { |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11749 GLint copyWidth = 0; | 11749 GLint copyWidth = 0; |
11750 GLint copyHeight = 0; | 11750 GLint copyHeight = 0; |
11751 Clip(x, width, size.width(), ©X, ©Width); | 11751 Clip(x, width, size.width(), ©X, ©Width); |
11752 Clip(y, height, size.height(), ©Y, ©Height); | 11752 Clip(y, height, size.height(), ©Y, ©Height); |
11753 | 11753 |
11754 if (copyX != x || | 11754 if (copyX != x || |
11755 copyY != y || | 11755 copyY != y || |
11756 copyWidth != width || | 11756 copyWidth != width || |
11757 copyHeight != height) { | 11757 copyHeight != height) { |
11758 // some part was clipped so clear the rect. | 11758 // some part was clipped so clear the rect. |
11759 scoped_ptr<char[]> zero(new char[pixels_size]); | 11759 std::unique_ptr<char[]> zero(new char[pixels_size]); |
11760 memset(zero.get(), 0, pixels_size); | 11760 memset(zero.get(), 0, pixels_size); |
11761 glTexImage2D(target, level, | 11761 glTexImage2D(target, level, |
11762 texture_manager()->AdjustTexInternalFormat(internal_format), | 11762 texture_manager()->AdjustTexInternalFormat(internal_format), |
11763 width, height, border, format, type, zero.get()); | 11763 width, height, border, format, type, zero.get()); |
11764 if (copyHeight > 0 && copyWidth > 0) { | 11764 if (copyHeight > 0 && copyWidth > 0) { |
11765 GLint dx = copyX - x; | 11765 GLint dx = copyX - x; |
11766 GLint dy = copyY - y; | 11766 GLint dy = copyY - y; |
11767 GLint destX = dx; | 11767 GLint destX = dx; |
11768 GLint destY = dy; | 11768 GLint destY = dy; |
11769 glCopyTexSubImage2D(target, level, | 11769 glCopyTexSubImage2D(target, level, |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12271 cmds::GetUniformfv::Result* result; | 12271 cmds::GetUniformfv::Result* result; |
12272 GLenum result_type; | 12272 GLenum result_type; |
12273 GLsizei result_size; | 12273 GLsizei result_size; |
12274 if (GetUniformSetup<GLfloat>(program, fake_location, c.params_shm_id, | 12274 if (GetUniformSetup<GLfloat>(program, fake_location, c.params_shm_id, |
12275 c.params_shm_offset, &error, &real_location, | 12275 c.params_shm_offset, &error, &real_location, |
12276 &service_id, &result, &result_type, | 12276 &service_id, &result, &result_type, |
12277 &result_size)) { | 12277 &result_size)) { |
12278 if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || | 12278 if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || |
12279 result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { | 12279 result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { |
12280 GLsizei num_values = result_size / sizeof(GLfloat); | 12280 GLsizei num_values = result_size / sizeof(GLfloat); |
12281 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 12281 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
12282 glGetUniformiv(service_id, real_location, temp.get()); | 12282 glGetUniformiv(service_id, real_location, temp.get()); |
12283 GLfloat* dst = result->GetData(); | 12283 GLfloat* dst = result->GetData(); |
12284 for (GLsizei ii = 0; ii < num_values; ++ii) { | 12284 for (GLsizei ii = 0; ii < num_values; ++ii) { |
12285 dst[ii] = (temp[ii] != 0); | 12285 dst[ii] = (temp[ii] != 0); |
12286 } | 12286 } |
12287 } else { | 12287 } else { |
12288 glGetUniformfv(service_id, real_location, result->GetData()); | 12288 glGetUniformfv(service_id, real_location, result->GetData()); |
12289 } | 12289 } |
12290 } | 12290 } |
12291 return error; | 12291 return error; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12632 return error::kOutOfBounds; | 12632 return error::kOutOfBounds; |
12633 } | 12633 } |
12634 const GLuint* shaders = GetSharedMemoryAs<const GLuint*>( | 12634 const GLuint* shaders = GetSharedMemoryAs<const GLuint*>( |
12635 c.shaders_shm_id, c.shaders_shm_offset, data_size); | 12635 c.shaders_shm_id, c.shaders_shm_offset, data_size); |
12636 GLenum binaryformat = static_cast<GLenum>(c.binaryformat); | 12636 GLenum binaryformat = static_cast<GLenum>(c.binaryformat); |
12637 const void* binary = GetSharedMemoryAs<const void*>( | 12637 const void* binary = GetSharedMemoryAs<const void*>( |
12638 c.binary_shm_id, c.binary_shm_offset, length); | 12638 c.binary_shm_id, c.binary_shm_offset, length); |
12639 if (shaders == NULL || binary == NULL) { | 12639 if (shaders == NULL || binary == NULL) { |
12640 return error::kOutOfBounds; | 12640 return error::kOutOfBounds; |
12641 } | 12641 } |
12642 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 12642 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
12643 for (GLsizei ii = 0; ii < n; ++ii) { | 12643 for (GLsizei ii = 0; ii < n; ++ii) { |
12644 Shader* shader = GetShader(shaders[ii]); | 12644 Shader* shader = GetShader(shaders[ii]); |
12645 if (!shader) { | 12645 if (!shader) { |
12646 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "unknown shader"); | 12646 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "unknown shader"); |
12647 return error::kNoError; | 12647 return error::kNoError; |
12648 } | 12648 } |
12649 service_ids[ii] = shader->service_id(); | 12649 service_ids[ii] = shader->service_id(); |
12650 } | 12650 } |
12651 // TODO(gman): call glShaderBinary | 12651 // TODO(gman): call glShaderBinary |
12652 return error::kNoError; | 12652 return error::kNoError; |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13471 return false; | 13471 return false; |
13472 } | 13472 } |
13473 } | 13473 } |
13474 | 13474 |
13475 if (!features().native_vertex_array_object) { | 13475 if (!features().native_vertex_array_object) { |
13476 // Emulated VAO | 13476 // Emulated VAO |
13477 for (GLsizei ii = 0; ii < n; ++ii) { | 13477 for (GLsizei ii = 0; ii < n; ++ii) { |
13478 CreateVertexAttribManager(client_ids[ii], 0, true); | 13478 CreateVertexAttribManager(client_ids[ii], 0, true); |
13479 } | 13479 } |
13480 } else { | 13480 } else { |
13481 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 13481 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
13482 | 13482 |
13483 glGenVertexArraysOES(n, service_ids.get()); | 13483 glGenVertexArraysOES(n, service_ids.get()); |
13484 for (GLsizei ii = 0; ii < n; ++ii) { | 13484 for (GLsizei ii = 0; ii < n; ++ii) { |
13485 CreateVertexAttribManager(client_ids[ii], service_ids[ii], true); | 13485 CreateVertexAttribManager(client_ids[ii], service_ids[ii], true); |
13486 } | 13486 } |
13487 } | 13487 } |
13488 | 13488 |
13489 return true; | 13489 return true; |
13490 } | 13490 } |
13491 | 13491 |
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15333 transform_type, "transformType"); | 15333 transform_type, "transformType"); |
15334 return false; | 15334 return false; |
15335 } | 15335 } |
15336 *out_transform_type = transform_type; | 15336 *out_transform_type = transform_type; |
15337 return true; | 15337 return true; |
15338 } | 15338 } |
15339 template <typename Cmd> | 15339 template <typename Cmd> |
15340 bool GetPathNameData(const Cmd& cmd, | 15340 bool GetPathNameData(const Cmd& cmd, |
15341 GLuint num_paths, | 15341 GLuint num_paths, |
15342 GLenum path_name_type, | 15342 GLenum path_name_type, |
15343 scoped_ptr<GLuint[]>* out_buffer) { | 15343 std::unique_ptr<GLuint[]>* out_buffer) { |
15344 DCHECK(validators_->path_name_type.IsValid(path_name_type)); | 15344 DCHECK(validators_->path_name_type.IsValid(path_name_type)); |
15345 GLuint path_base = static_cast<GLuint>(cmd.pathBase); | 15345 GLuint path_base = static_cast<GLuint>(cmd.pathBase); |
15346 uint32_t shm_id = static_cast<uint32_t>(cmd.paths_shm_id); | 15346 uint32_t shm_id = static_cast<uint32_t>(cmd.paths_shm_id); |
15347 uint32_t shm_offset = static_cast<uint32_t>(cmd.paths_shm_offset); | 15347 uint32_t shm_offset = static_cast<uint32_t>(cmd.paths_shm_offset); |
15348 if (shm_id == 0 && shm_offset == 0) { | 15348 if (shm_id == 0 && shm_offset == 0) { |
15349 error_ = error::kOutOfBounds; | 15349 error_ = error::kOutOfBounds; |
15350 return false; | 15350 return false; |
15351 } | 15351 } |
15352 switch (path_name_type) { | 15352 switch (path_name_type) { |
15353 case GL_BYTE: | 15353 case GL_BYTE: |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15420 *out_cover_mode = cover_mode; | 15420 *out_cover_mode = cover_mode; |
15421 return true; | 15421 return true; |
15422 } | 15422 } |
15423 | 15423 |
15424 private: | 15424 private: |
15425 template <typename T> | 15425 template <typename T> |
15426 bool GetPathNameDataImpl(GLuint num_paths, | 15426 bool GetPathNameDataImpl(GLuint num_paths, |
15427 GLuint path_base, | 15427 GLuint path_base, |
15428 uint32_t shm_id, | 15428 uint32_t shm_id, |
15429 uint32_t shm_offset, | 15429 uint32_t shm_offset, |
15430 scoped_ptr<GLuint[]>* out_buffer) { | 15430 std::unique_ptr<GLuint[]>* out_buffer) { |
15431 uint32_t paths_size = 0; | 15431 uint32_t paths_size = 0; |
15432 if (!SafeMultiplyUint32(num_paths, sizeof(T), &paths_size)) { | 15432 if (!SafeMultiplyUint32(num_paths, sizeof(T), &paths_size)) { |
15433 error_ = error::kOutOfBounds; | 15433 error_ = error::kOutOfBounds; |
15434 return false; | 15434 return false; |
15435 } | 15435 } |
15436 T* paths = decoder_->GetSharedMemoryAs<T*>(shm_id, shm_offset, paths_size); | 15436 T* paths = decoder_->GetSharedMemoryAs<T*>(shm_id, shm_offset, paths_size); |
15437 if (!paths) { | 15437 if (!paths) { |
15438 error_ = error::kOutOfBounds; | 15438 error_ = error::kOutOfBounds; |
15439 return false; | 15439 return false; |
15440 } | 15440 } |
15441 scoped_ptr<GLuint[]> result_paths(new GLuint[num_paths]); | 15441 std::unique_ptr<GLuint[]> result_paths(new GLuint[num_paths]); |
15442 bool has_paths = false; | 15442 bool has_paths = false; |
15443 for (GLuint i = 0; i < num_paths; ++i) { | 15443 for (GLuint i = 0; i < num_paths; ++i) { |
15444 GLuint service_id = 0; | 15444 GLuint service_id = 0; |
15445 // The below addition is ok even with over- and underflows. | 15445 // The below addition is ok even with over- and underflows. |
15446 // There is no difference if client passes: | 15446 // There is no difference if client passes: |
15447 // * base==4, T=GLbyte, paths[0]==0xfa (-6) | 15447 // * base==4, T=GLbyte, paths[0]==0xfa (-6) |
15448 // * base==0xffffffff, T=GLuint, paths[0]==0xffffffff | 15448 // * base==0xffffffff, T=GLuint, paths[0]==0xffffffff |
15449 // * base==0, T=GLuint, paths[0]==0xfffffffe | 15449 // * base==0, T=GLuint, paths[0]==0xfffffffe |
15450 // For the all the cases, the interpretation is that | 15450 // For the all the cases, the interpretation is that |
15451 // client intends to use the path 0xfffffffe. | 15451 // client intends to use the path 0xfffffffe. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15546 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCoords < 0"); | 15546 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCoords < 0"); |
15547 return error::kNoError; | 15547 return error::kNoError; |
15548 } | 15548 } |
15549 | 15549 |
15550 GLenum coord_type = static_cast<uint32_t>(c.coordType); | 15550 GLenum coord_type = static_cast<uint32_t>(c.coordType); |
15551 if (!validators_->path_coord_type.IsValid(static_cast<GLint>(coord_type))) { | 15551 if (!validators_->path_coord_type.IsValid(static_cast<GLint>(coord_type))) { |
15552 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName, "invalid coordType"); | 15552 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName, "invalid coordType"); |
15553 return error::kNoError; | 15553 return error::kNoError; |
15554 } | 15554 } |
15555 | 15555 |
15556 scoped_ptr<GLubyte[]> commands; | 15556 std::unique_ptr<GLubyte[]> commands; |
15557 base::CheckedNumeric<GLsizei> num_coords_expected = 0; | 15557 base::CheckedNumeric<GLsizei> num_coords_expected = 0; |
15558 | 15558 |
15559 if (num_commands > 0) { | 15559 if (num_commands > 0) { |
15560 uint32_t commands_shm_id = static_cast<uint32_t>(c.commands_shm_id); | 15560 uint32_t commands_shm_id = static_cast<uint32_t>(c.commands_shm_id); |
15561 uint32_t commands_shm_offset = static_cast<uint32_t>(c.commands_shm_offset); | 15561 uint32_t commands_shm_offset = static_cast<uint32_t>(c.commands_shm_offset); |
15562 if (commands_shm_id != 0 || commands_shm_offset != 0) { | 15562 if (commands_shm_id != 0 || commands_shm_offset != 0) { |
15563 const GLubyte* shared_commands = GetSharedMemoryAs<const GLubyte*>( | 15563 const GLubyte* shared_commands = GetSharedMemoryAs<const GLubyte*>( |
15564 commands_shm_id, commands_shm_offset, num_commands); | 15564 commands_shm_id, commands_shm_offset, num_commands); |
15565 if (shared_commands) { | 15565 if (shared_commands) { |
15566 commands.reset(new GLubyte[num_commands]); | 15566 commands.reset(new GLubyte[num_commands]); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15884 GLuint mask = 0; | 15884 GLuint mask = 0; |
15885 GLenum transform_type = GL_NONE; | 15885 GLenum transform_type = GL_NONE; |
15886 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 15886 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
15887 !v.GetFillModeAndMask(c, &fill_mode, &mask) || | 15887 !v.GetFillModeAndMask(c, &fill_mode, &mask) || |
15888 !v.GetTransformType(c, &transform_type)) | 15888 !v.GetTransformType(c, &transform_type)) |
15889 return v.error(); | 15889 return v.error(); |
15890 | 15890 |
15891 if (num_paths == 0) | 15891 if (num_paths == 0) |
15892 return error::kNoError; | 15892 return error::kNoError; |
15893 | 15893 |
15894 scoped_ptr<GLuint[]> paths; | 15894 std::unique_ptr<GLuint[]> paths; |
15895 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 15895 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
15896 return v.error(); | 15896 return v.error(); |
15897 | 15897 |
15898 const GLfloat* transforms = nullptr; | 15898 const GLfloat* transforms = nullptr; |
15899 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 15899 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
15900 return v.error(); | 15900 return v.error(); |
15901 | 15901 |
15902 ApplyDirtyState(); | 15902 ApplyDirtyState(); |
15903 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, | 15903 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, |
15904 fill_mode, mask, transform_type, transforms); | 15904 fill_mode, mask, transform_type, transforms); |
(...skipping 13 matching lines...) Expand all Loading... |
15918 GLuint num_paths = 0; | 15918 GLuint num_paths = 0; |
15919 GLenum path_name_type = GL_NONE; | 15919 GLenum path_name_type = GL_NONE; |
15920 GLenum transform_type = GL_NONE; | 15920 GLenum transform_type = GL_NONE; |
15921 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 15921 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
15922 !v.GetTransformType(c, &transform_type)) | 15922 !v.GetTransformType(c, &transform_type)) |
15923 return v.error(); | 15923 return v.error(); |
15924 | 15924 |
15925 if (num_paths == 0) | 15925 if (num_paths == 0) |
15926 return error::kNoError; | 15926 return error::kNoError; |
15927 | 15927 |
15928 scoped_ptr<GLuint[]> paths; | 15928 std::unique_ptr<GLuint[]> paths; |
15929 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 15929 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
15930 return v.error(); | 15930 return v.error(); |
15931 | 15931 |
15932 const GLfloat* transforms = nullptr; | 15932 const GLfloat* transforms = nullptr; |
15933 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 15933 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
15934 return v.error(); | 15934 return v.error(); |
15935 | 15935 |
15936 GLint reference = static_cast<GLint>(c.reference); | 15936 GLint reference = static_cast<GLint>(c.reference); |
15937 GLuint mask = static_cast<GLuint>(c.mask); | 15937 GLuint mask = static_cast<GLuint>(c.mask); |
15938 ApplyDirtyState(); | 15938 ApplyDirtyState(); |
(...skipping 17 matching lines...) Expand all Loading... |
15956 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; | 15956 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; |
15957 GLenum transform_type = GL_NONE; | 15957 GLenum transform_type = GL_NONE; |
15958 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 15958 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
15959 !v.GetCoverMode(c, &cover_mode) || | 15959 !v.GetCoverMode(c, &cover_mode) || |
15960 !v.GetTransformType(c, &transform_type)) | 15960 !v.GetTransformType(c, &transform_type)) |
15961 return v.error(); | 15961 return v.error(); |
15962 | 15962 |
15963 if (num_paths == 0) | 15963 if (num_paths == 0) |
15964 return error::kNoError; | 15964 return error::kNoError; |
15965 | 15965 |
15966 scoped_ptr<GLuint[]> paths; | 15966 std::unique_ptr<GLuint[]> paths; |
15967 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 15967 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
15968 return v.error(); | 15968 return v.error(); |
15969 | 15969 |
15970 const GLfloat* transforms = nullptr; | 15970 const GLfloat* transforms = nullptr; |
15971 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 15971 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
15972 return v.error(); | 15972 return v.error(); |
15973 | 15973 |
15974 ApplyDirtyState(); | 15974 ApplyDirtyState(); |
15975 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, | 15975 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, |
15976 cover_mode, transform_type, transforms); | 15976 cover_mode, transform_type, transforms); |
(...skipping 15 matching lines...) Expand all Loading... |
15992 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; | 15992 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; |
15993 GLenum transform_type = GL_NONE; | 15993 GLenum transform_type = GL_NONE; |
15994 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 15994 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
15995 !v.GetCoverMode(c, &cover_mode) || | 15995 !v.GetCoverMode(c, &cover_mode) || |
15996 !v.GetTransformType(c, &transform_type)) | 15996 !v.GetTransformType(c, &transform_type)) |
15997 return v.error(); | 15997 return v.error(); |
15998 | 15998 |
15999 if (num_paths == 0) | 15999 if (num_paths == 0) |
16000 return error::kNoError; | 16000 return error::kNoError; |
16001 | 16001 |
16002 scoped_ptr<GLuint[]> paths; | 16002 std::unique_ptr<GLuint[]> paths; |
16003 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16003 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16004 return v.error(); | 16004 return v.error(); |
16005 | 16005 |
16006 const GLfloat* transforms = nullptr; | 16006 const GLfloat* transforms = nullptr; |
16007 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16007 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16008 return v.error(); | 16008 return v.error(); |
16009 | 16009 |
16010 ApplyDirtyState(); | 16010 ApplyDirtyState(); |
16011 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, | 16011 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, |
16012 cover_mode, transform_type, transforms); | 16012 cover_mode, transform_type, transforms); |
(...skipping 19 matching lines...) Expand all Loading... |
16032 GLenum transform_type = GL_NONE; | 16032 GLenum transform_type = GL_NONE; |
16033 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 16033 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
16034 !v.GetFillModeAndMask(c, &fill_mode, &mask) || | 16034 !v.GetFillModeAndMask(c, &fill_mode, &mask) || |
16035 !v.GetCoverMode(c, &cover_mode) || | 16035 !v.GetCoverMode(c, &cover_mode) || |
16036 !v.GetTransformType(c, &transform_type)) | 16036 !v.GetTransformType(c, &transform_type)) |
16037 return v.error(); | 16037 return v.error(); |
16038 | 16038 |
16039 if (num_paths == 0) | 16039 if (num_paths == 0) |
16040 return error::kNoError; | 16040 return error::kNoError; |
16041 | 16041 |
16042 scoped_ptr<GLuint[]> paths; | 16042 std::unique_ptr<GLuint[]> paths; |
16043 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16043 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16044 return v.error(); | 16044 return v.error(); |
16045 | 16045 |
16046 const GLfloat* transforms = nullptr; | 16046 const GLfloat* transforms = nullptr; |
16047 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16047 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16048 return v.error(); | 16048 return v.error(); |
16049 | 16049 |
16050 ApplyDirtyState(); | 16050 ApplyDirtyState(); |
16051 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), | 16051 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), |
16052 0, fill_mode, mask, cover_mode, | 16052 0, fill_mode, mask, cover_mode, |
(...skipping 18 matching lines...) Expand all Loading... |
16071 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; | 16071 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; |
16072 GLenum transform_type = GL_NONE; | 16072 GLenum transform_type = GL_NONE; |
16073 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 16073 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
16074 !v.GetCoverMode(c, &cover_mode) || | 16074 !v.GetCoverMode(c, &cover_mode) || |
16075 !v.GetTransformType(c, &transform_type)) | 16075 !v.GetTransformType(c, &transform_type)) |
16076 return v.error(); | 16076 return v.error(); |
16077 | 16077 |
16078 if (num_paths == 0) | 16078 if (num_paths == 0) |
16079 return error::kNoError; | 16079 return error::kNoError; |
16080 | 16080 |
16081 scoped_ptr<GLuint[]> paths; | 16081 std::unique_ptr<GLuint[]> paths; |
16082 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16082 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16083 return v.error(); | 16083 return v.error(); |
16084 | 16084 |
16085 const GLfloat* transforms = nullptr; | 16085 const GLfloat* transforms = nullptr; |
16086 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16086 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16087 return v.error(); | 16087 return v.error(); |
16088 | 16088 |
16089 GLint reference = static_cast<GLint>(c.reference); | 16089 GLint reference = static_cast<GLint>(c.reference); |
16090 GLuint mask = static_cast<GLuint>(c.mask); | 16090 GLuint mask = static_cast<GLuint>(c.mask); |
16091 ApplyDirtyState(); | 16091 ApplyDirtyState(); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16363 } | 16363 } |
16364 | 16364 |
16365 // Include the auto-generated part of this file. We split this because it means | 16365 // Include the auto-generated part of this file. We split this because it means |
16366 // we can easily edit the non-auto generated parts right here in this file | 16366 // we can easily edit the non-auto generated parts right here in this file |
16367 // instead of having to edit some template or the code generator. | 16367 // instead of having to edit some template or the code generator. |
16368 #include "base/macros.h" | 16368 #include "base/macros.h" |
16369 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16369 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
16370 | 16370 |
16371 } // namespace gles2 | 16371 } // namespace gles2 |
16372 } // namespace gpu | 16372 } // namespace gpu |
OLD | NEW |