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 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 // The buffer used to simulate GL_FIXED attribs. | 1982 // The buffer used to simulate GL_FIXED attribs. |
1983 GLuint fixed_attrib_buffer_id_; | 1983 GLuint fixed_attrib_buffer_id_; |
1984 | 1984 |
1985 // The size of fiixed attrib buffer. | 1985 // The size of fiixed attrib buffer. |
1986 GLsizei fixed_attrib_buffer_size_; | 1986 GLsizei fixed_attrib_buffer_size_; |
1987 | 1987 |
1988 // The offscreen frame buffer that the client renders to. With EGL, the | 1988 // The offscreen frame buffer that the client renders to. With EGL, the |
1989 // depth and stencil buffers are separate. With regular GL there is a single | 1989 // depth and stencil buffers are separate. With regular GL there is a single |
1990 // packed depth stencil buffer in offscreen_target_depth_render_buffer_. | 1990 // packed depth stencil buffer in offscreen_target_depth_render_buffer_. |
1991 // offscreen_target_stencil_render_buffer_ is unused. | 1991 // offscreen_target_stencil_render_buffer_ is unused. |
1992 scoped_ptr<BackFramebuffer> offscreen_target_frame_buffer_; | 1992 std::unique_ptr<BackFramebuffer> offscreen_target_frame_buffer_; |
1993 scoped_ptr<BackTexture> offscreen_target_color_texture_; | 1993 std::unique_ptr<BackTexture> offscreen_target_color_texture_; |
1994 scoped_ptr<BackRenderbuffer> offscreen_target_color_render_buffer_; | 1994 std::unique_ptr<BackRenderbuffer> offscreen_target_color_render_buffer_; |
1995 scoped_ptr<BackRenderbuffer> offscreen_target_depth_render_buffer_; | 1995 std::unique_ptr<BackRenderbuffer> offscreen_target_depth_render_buffer_; |
1996 scoped_ptr<BackRenderbuffer> offscreen_target_stencil_render_buffer_; | 1996 std::unique_ptr<BackRenderbuffer> offscreen_target_stencil_render_buffer_; |
1997 GLenum offscreen_target_color_format_; | 1997 GLenum offscreen_target_color_format_; |
1998 GLenum offscreen_target_depth_format_; | 1998 GLenum offscreen_target_depth_format_; |
1999 GLenum offscreen_target_stencil_format_; | 1999 GLenum offscreen_target_stencil_format_; |
2000 GLsizei offscreen_target_samples_; | 2000 GLsizei offscreen_target_samples_; |
2001 GLboolean offscreen_target_buffer_preserved_; | 2001 GLboolean offscreen_target_buffer_preserved_; |
2002 | 2002 |
2003 // The copy that is saved when SwapBuffers is called. | 2003 // The copy that is saved when SwapBuffers is called. |
2004 scoped_ptr<BackFramebuffer> offscreen_saved_frame_buffer_; | 2004 std::unique_ptr<BackFramebuffer> offscreen_saved_frame_buffer_; |
2005 scoped_ptr<BackTexture> offscreen_saved_color_texture_; | 2005 std::unique_ptr<BackTexture> offscreen_saved_color_texture_; |
2006 scoped_refptr<TextureRef> | 2006 scoped_refptr<TextureRef> |
2007 offscreen_saved_color_texture_info_; | 2007 offscreen_saved_color_texture_info_; |
2008 | 2008 |
2009 // The copy that is used as the destination for multi-sample resolves. | 2009 // The copy that is used as the destination for multi-sample resolves. |
2010 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; | 2010 std::unique_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; |
2011 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; | 2011 std::unique_ptr<BackTexture> offscreen_resolved_color_texture_; |
2012 GLenum offscreen_saved_color_format_; | 2012 GLenum offscreen_saved_color_format_; |
2013 | 2013 |
2014 scoped_ptr<QueryManager> query_manager_; | 2014 std::unique_ptr<QueryManager> query_manager_; |
2015 | 2015 |
2016 scoped_ptr<VertexArrayManager> vertex_array_manager_; | 2016 std::unique_ptr<VertexArrayManager> vertex_array_manager_; |
2017 | 2017 |
2018 scoped_ptr<ImageManager> image_manager_; | 2018 std::unique_ptr<ImageManager> image_manager_; |
2019 | 2019 |
2020 FenceSyncReleaseCallback fence_sync_release_callback_; | 2020 FenceSyncReleaseCallback fence_sync_release_callback_; |
2021 WaitFenceSyncCallback wait_fence_sync_callback_; | 2021 WaitFenceSyncCallback wait_fence_sync_callback_; |
2022 | 2022 |
2023 ShaderCacheCallback shader_cache_callback_; | 2023 ShaderCacheCallback shader_cache_callback_; |
2024 | 2024 |
2025 // The format of the back buffer_ | 2025 // The format of the back buffer_ |
2026 GLenum back_buffer_color_format_; | 2026 GLenum back_buffer_color_format_; |
2027 bool back_buffer_has_depth_; | 2027 bool back_buffer_has_depth_; |
2028 bool back_buffer_has_stencil_; | 2028 bool back_buffer_has_stencil_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 bool lose_context_when_out_of_memory_; | 2084 bool lose_context_when_out_of_memory_; |
2085 | 2085 |
2086 // Log extra info. | 2086 // Log extra info. |
2087 bool service_logging_; | 2087 bool service_logging_; |
2088 | 2088 |
2089 #if defined(OS_MACOSX) | 2089 #if defined(OS_MACOSX) |
2090 typedef std::map<GLuint, IOSurfaceRef> TextureToIOSurfaceMap; | 2090 typedef std::map<GLuint, IOSurfaceRef> TextureToIOSurfaceMap; |
2091 TextureToIOSurfaceMap texture_to_io_surface_map_; | 2091 TextureToIOSurfaceMap texture_to_io_surface_map_; |
2092 #endif | 2092 #endif |
2093 | 2093 |
2094 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | 2094 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
2095 scoped_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; | 2095 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; |
2096 | 2096 |
2097 // Cached values of the currently assigned viewport dimensions. | 2097 // Cached values of the currently assigned viewport dimensions. |
2098 GLsizei viewport_max_width_; | 2098 GLsizei viewport_max_width_; |
2099 GLsizei viewport_max_height_; | 2099 GLsizei viewport_max_height_; |
2100 | 2100 |
2101 // Command buffer stats. | 2101 // Command buffer stats. |
2102 base::TimeDelta total_processing_commands_time_; | 2102 base::TimeDelta total_processing_commands_time_; |
2103 | 2103 |
2104 // States related to each manager. | 2104 // States related to each manager. |
2105 DecoderTextureState texture_state_; | 2105 DecoderTextureState texture_state_; |
2106 DecoderFramebufferState framebuffer_state_; | 2106 DecoderFramebufferState framebuffer_state_; |
2107 | 2107 |
2108 scoped_ptr<GPUTracer> gpu_tracer_; | 2108 std::unique_ptr<GPUTracer> gpu_tracer_; |
2109 scoped_ptr<GPUStateTracer> gpu_state_tracer_; | 2109 std::unique_ptr<GPUStateTracer> gpu_state_tracer_; |
2110 const unsigned char* gpu_decoder_category_; | 2110 const unsigned char* gpu_decoder_category_; |
2111 int gpu_trace_level_; | 2111 int gpu_trace_level_; |
2112 bool gpu_trace_commands_; | 2112 bool gpu_trace_commands_; |
2113 bool gpu_debug_commands_; | 2113 bool gpu_debug_commands_; |
2114 | 2114 |
2115 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; | 2115 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; |
2116 | 2116 |
2117 // Used to validate multisample renderbuffers if needed | 2117 // Used to validate multisample renderbuffers if needed |
2118 GLuint validation_texture_; | 2118 GLuint validation_texture_; |
2119 GLuint validation_fbo_multisample_; | 2119 GLuint validation_fbo_multisample_; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2388 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); | 2388 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); |
2389 uint32_t image_size = 0; | 2389 uint32_t image_size = 0; |
2390 GLES2Util::ComputeImageDataSizes( | 2390 GLES2Util::ComputeImageDataSizes( |
2391 size.width(), size.height(), 1, format, GL_UNSIGNED_BYTE, 8, &image_size, | 2391 size.width(), size.height(), 1, format, GL_UNSIGNED_BYTE, 8, &image_size, |
2392 NULL, NULL); | 2392 NULL, NULL); |
2393 | 2393 |
2394 if (!memory_tracker_.EnsureGPUMemoryAvailable(image_size)) { | 2394 if (!memory_tracker_.EnsureGPUMemoryAvailable(image_size)) { |
2395 return false; | 2395 return false; |
2396 } | 2396 } |
2397 | 2397 |
2398 scoped_ptr<char[]> zero_data; | 2398 std::unique_ptr<char[]> zero_data; |
2399 if (zero) { | 2399 if (zero) { |
2400 zero_data.reset(new char[image_size]); | 2400 zero_data.reset(new char[image_size]); |
2401 memset(zero_data.get(), 0, image_size); | 2401 memset(zero_data.get(), 0, image_size); |
2402 } | 2402 } |
2403 | 2403 |
2404 glTexImage2D(GL_TEXTURE_2D, | 2404 glTexImage2D(GL_TEXTURE_2D, |
2405 0, // mip level | 2405 0, // mip level |
2406 format, | 2406 format, |
2407 size.width(), | 2407 size.width(), |
2408 size.height(), | 2408 size.height(), |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3412 } | 3412 } |
3413 return true; | 3413 return true; |
3414 } | 3414 } |
3415 | 3415 |
3416 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { | 3416 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { |
3417 for (GLsizei ii = 0; ii < n; ++ii) { | 3417 for (GLsizei ii = 0; ii < n; ++ii) { |
3418 if (GetBuffer(client_ids[ii])) { | 3418 if (GetBuffer(client_ids[ii])) { |
3419 return false; | 3419 return false; |
3420 } | 3420 } |
3421 } | 3421 } |
3422 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3422 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3423 glGenBuffersARB(n, service_ids.get()); | 3423 glGenBuffersARB(n, service_ids.get()); |
3424 for (GLsizei ii = 0; ii < n; ++ii) { | 3424 for (GLsizei ii = 0; ii < n; ++ii) { |
3425 CreateBuffer(client_ids[ii], service_ids[ii]); | 3425 CreateBuffer(client_ids[ii], service_ids[ii]); |
3426 } | 3426 } |
3427 return true; | 3427 return true; |
3428 } | 3428 } |
3429 | 3429 |
3430 bool GLES2DecoderImpl::GenFramebuffersHelper( | 3430 bool GLES2DecoderImpl::GenFramebuffersHelper( |
3431 GLsizei n, const GLuint* client_ids) { | 3431 GLsizei n, const GLuint* client_ids) { |
3432 for (GLsizei ii = 0; ii < n; ++ii) { | 3432 for (GLsizei ii = 0; ii < n; ++ii) { |
3433 if (GetFramebuffer(client_ids[ii])) { | 3433 if (GetFramebuffer(client_ids[ii])) { |
3434 return false; | 3434 return false; |
3435 } | 3435 } |
3436 } | 3436 } |
3437 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3437 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3438 glGenFramebuffersEXT(n, service_ids.get()); | 3438 glGenFramebuffersEXT(n, service_ids.get()); |
3439 for (GLsizei ii = 0; ii < n; ++ii) { | 3439 for (GLsizei ii = 0; ii < n; ++ii) { |
3440 CreateFramebuffer(client_ids[ii], service_ids[ii]); | 3440 CreateFramebuffer(client_ids[ii], service_ids[ii]); |
3441 } | 3441 } |
3442 return true; | 3442 return true; |
3443 } | 3443 } |
3444 | 3444 |
3445 bool GLES2DecoderImpl::GenRenderbuffersHelper( | 3445 bool GLES2DecoderImpl::GenRenderbuffersHelper( |
3446 GLsizei n, const GLuint* client_ids) { | 3446 GLsizei n, const GLuint* client_ids) { |
3447 for (GLsizei ii = 0; ii < n; ++ii) { | 3447 for (GLsizei ii = 0; ii < n; ++ii) { |
3448 if (GetRenderbuffer(client_ids[ii])) { | 3448 if (GetRenderbuffer(client_ids[ii])) { |
3449 return false; | 3449 return false; |
3450 } | 3450 } |
3451 } | 3451 } |
3452 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3452 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3453 glGenRenderbuffersEXT(n, service_ids.get()); | 3453 glGenRenderbuffersEXT(n, service_ids.get()); |
3454 for (GLsizei ii = 0; ii < n; ++ii) { | 3454 for (GLsizei ii = 0; ii < n; ++ii) { |
3455 CreateRenderbuffer(client_ids[ii], service_ids[ii]); | 3455 CreateRenderbuffer(client_ids[ii], service_ids[ii]); |
3456 } | 3456 } |
3457 return true; | 3457 return true; |
3458 } | 3458 } |
3459 | 3459 |
3460 bool GLES2DecoderImpl::GenValuebuffersCHROMIUMHelper(GLsizei n, | 3460 bool GLES2DecoderImpl::GenValuebuffersCHROMIUMHelper(GLsizei n, |
3461 const GLuint* client_ids) { | 3461 const GLuint* client_ids) { |
3462 for (GLsizei ii = 0; ii < n; ++ii) { | 3462 for (GLsizei ii = 0; ii < n; ++ii) { |
3463 if (GetValuebuffer(client_ids[ii])) { | 3463 if (GetValuebuffer(client_ids[ii])) { |
3464 return false; | 3464 return false; |
3465 } | 3465 } |
3466 } | 3466 } |
3467 for (GLsizei ii = 0; ii < n; ++ii) { | 3467 for (GLsizei ii = 0; ii < n; ++ii) { |
3468 CreateValuebuffer(client_ids[ii]); | 3468 CreateValuebuffer(client_ids[ii]); |
3469 } | 3469 } |
3470 return true; | 3470 return true; |
3471 } | 3471 } |
3472 | 3472 |
3473 bool GLES2DecoderImpl::GenTexturesHelper(GLsizei n, const GLuint* client_ids) { | 3473 bool GLES2DecoderImpl::GenTexturesHelper(GLsizei n, const GLuint* client_ids) { |
3474 for (GLsizei ii = 0; ii < n; ++ii) { | 3474 for (GLsizei ii = 0; ii < n; ++ii) { |
3475 if (GetTexture(client_ids[ii])) { | 3475 if (GetTexture(client_ids[ii])) { |
3476 return false; | 3476 return false; |
3477 } | 3477 } |
3478 } | 3478 } |
3479 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3479 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3480 glGenTextures(n, service_ids.get()); | 3480 glGenTextures(n, service_ids.get()); |
3481 for (GLsizei ii = 0; ii < n; ++ii) { | 3481 for (GLsizei ii = 0; ii < n; ++ii) { |
3482 CreateTexture(client_ids[ii], service_ids[ii]); | 3482 CreateTexture(client_ids[ii], service_ids[ii]); |
3483 } | 3483 } |
3484 return true; | 3484 return true; |
3485 } | 3485 } |
3486 | 3486 |
3487 bool GLES2DecoderImpl::GenSamplersHelper(GLsizei n, const GLuint* client_ids) { | 3487 bool GLES2DecoderImpl::GenSamplersHelper(GLsizei n, const GLuint* client_ids) { |
3488 for (GLsizei ii = 0; ii < n; ++ii) { | 3488 for (GLsizei ii = 0; ii < n; ++ii) { |
3489 if (GetSampler(client_ids[ii])) { | 3489 if (GetSampler(client_ids[ii])) { |
3490 return false; | 3490 return false; |
3491 } | 3491 } |
3492 } | 3492 } |
3493 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 3493 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
3494 glGenSamplers(n, service_ids.get()); | 3494 glGenSamplers(n, service_ids.get()); |
3495 for (GLsizei ii = 0; ii < n; ++ii) { | 3495 for (GLsizei ii = 0; ii < n; ++ii) { |
3496 CreateSampler(client_ids[ii], service_ids[ii]); | 3496 CreateSampler(client_ids[ii], service_ids[ii]); |
3497 } | 3497 } |
3498 return true; | 3498 return true; |
3499 } | 3499 } |
3500 | 3500 |
3501 bool GLES2DecoderImpl::GenPathsCHROMIUMHelper(GLuint first_client_id, | 3501 bool GLES2DecoderImpl::GenPathsCHROMIUMHelper(GLuint first_client_id, |
3502 GLsizei range) { | 3502 GLsizei range) { |
3503 GLuint last_client_id; | 3503 GLuint last_client_id; |
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5084 default: | 5084 default: |
5085 NOTREACHED(); | 5085 NOTREACHED(); |
5086 break; | 5086 break; |
5087 } | 5087 } |
5088 } | 5088 } |
5089 } | 5089 } |
5090 | 5090 |
5091 // If the default framebuffer is bound but we are still rendering to an | 5091 // If the default framebuffer is bound but we are still rendering to an |
5092 // FBO, translate attachment names that refer to default framebuffer | 5092 // FBO, translate attachment names that refer to default framebuffer |
5093 // channels to corresponding framebuffer attachments. | 5093 // channels to corresponding framebuffer attachments. |
5094 scoped_ptr<GLenum[]> translated_attachments(new GLenum[numAttachments]); | 5094 std::unique_ptr<GLenum[]> translated_attachments(new GLenum[numAttachments]); |
5095 for (GLsizei i = 0; i < numAttachments; ++i) { | 5095 for (GLsizei i = 0; i < numAttachments; ++i) { |
5096 GLenum attachment = attachments[i]; | 5096 GLenum attachment = attachments[i]; |
5097 if (!framebuffer && GetBackbufferServiceId()) { | 5097 if (!framebuffer && GetBackbufferServiceId()) { |
5098 switch (attachment) { | 5098 switch (attachment) { |
5099 case GL_COLOR_EXT: | 5099 case GL_COLOR_EXT: |
5100 attachment = GL_COLOR_ATTACHMENT0; | 5100 attachment = GL_COLOR_ATTACHMENT0; |
5101 break; | 5101 break; |
5102 case GL_DEPTH_EXT: | 5102 case GL_DEPTH_EXT: |
5103 attachment = GL_DEPTH_ATTACHMENT; | 5103 attachment = GL_DEPTH_ATTACHMENT; |
5104 break; | 5104 break; |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5690 feature_info_->gl_version_info().is_desktop_core_profile) { | 5690 feature_info_->gl_version_info().is_desktop_core_profile) { |
5691 return GL_POINT_SIZE_RANGE; | 5691 return GL_POINT_SIZE_RANGE; |
5692 } | 5692 } |
5693 return pname; | 5693 return pname; |
5694 } | 5694 } |
5695 | 5695 |
5696 void GLES2DecoderImpl::DoGetBooleanv(GLenum pname, GLboolean* params) { | 5696 void GLES2DecoderImpl::DoGetBooleanv(GLenum pname, GLboolean* params) { |
5697 DCHECK(params); | 5697 DCHECK(params); |
5698 GLsizei num_written = 0; | 5698 GLsizei num_written = 0; |
5699 if (GetNumValuesReturnedForGLGet(pname, &num_written)) { | 5699 if (GetNumValuesReturnedForGLGet(pname, &num_written)) { |
5700 scoped_ptr<GLint[]> values(new GLint[num_written]); | 5700 std::unique_ptr<GLint[]> values(new GLint[num_written]); |
5701 if (!state_.GetStateAsGLint(pname, values.get(), &num_written)) { | 5701 if (!state_.GetStateAsGLint(pname, values.get(), &num_written)) { |
5702 GetHelper(pname, values.get(), &num_written); | 5702 GetHelper(pname, values.get(), &num_written); |
5703 } | 5703 } |
5704 for (GLsizei ii = 0; ii < num_written; ++ii) { | 5704 for (GLsizei ii = 0; ii < num_written; ++ii) { |
5705 params[ii] = static_cast<GLboolean>(values[ii]); | 5705 params[ii] = static_cast<GLboolean>(values[ii]); |
5706 } | 5706 } |
5707 } else { | 5707 } else { |
5708 pname = AdjustGetPname(pname); | 5708 pname = AdjustGetPname(pname); |
5709 glGetBooleanv(pname, params); | 5709 glGetBooleanv(pname, params); |
5710 } | 5710 } |
5711 } | 5711 } |
5712 | 5712 |
5713 void GLES2DecoderImpl::DoGetFloatv(GLenum pname, GLfloat* params) { | 5713 void GLES2DecoderImpl::DoGetFloatv(GLenum pname, GLfloat* params) { |
5714 DCHECK(params); | 5714 DCHECK(params); |
5715 GLsizei num_written = 0; | 5715 GLsizei num_written = 0; |
5716 if (!state_.GetStateAsGLfloat(pname, params, &num_written)) { | 5716 if (!state_.GetStateAsGLfloat(pname, params, &num_written)) { |
5717 if (GetHelper(pname, NULL, &num_written)) { | 5717 if (GetHelper(pname, NULL, &num_written)) { |
5718 scoped_ptr<GLint[]> values(new GLint[num_written]); | 5718 std::unique_ptr<GLint[]> values(new GLint[num_written]); |
5719 GetHelper(pname, values.get(), &num_written); | 5719 GetHelper(pname, values.get(), &num_written); |
5720 for (GLsizei ii = 0; ii < num_written; ++ii) { | 5720 for (GLsizei ii = 0; ii < num_written; ++ii) { |
5721 params[ii] = static_cast<GLfloat>(values[ii]); | 5721 params[ii] = static_cast<GLfloat>(values[ii]); |
5722 } | 5722 } |
5723 } else { | 5723 } else { |
5724 pname = AdjustGetPname(pname); | 5724 pname = AdjustGetPname(pname); |
5725 glGetFloatv(pname, params); | 5725 glGetFloatv(pname, params); |
5726 } | 5726 } |
5727 } | 5727 } |
5728 } | 5728 } |
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7372 GLint real_location = -1; | 7372 GLint real_location = -1; |
7373 if (!PrepForSetUniformByLocation(fake_location, | 7373 if (!PrepForSetUniformByLocation(fake_location, |
7374 "glUniform1fv", | 7374 "glUniform1fv", |
7375 Program::kUniform1f, | 7375 Program::kUniform1f, |
7376 &real_location, | 7376 &real_location, |
7377 &type, | 7377 &type, |
7378 &count)) { | 7378 &count)) { |
7379 return; | 7379 return; |
7380 } | 7380 } |
7381 if (type == GL_BOOL) { | 7381 if (type == GL_BOOL) { |
7382 scoped_ptr<GLint[]> temp(new GLint[count]); | 7382 std::unique_ptr<GLint[]> temp(new GLint[count]); |
7383 for (GLsizei ii = 0; ii < count; ++ii) { | 7383 for (GLsizei ii = 0; ii < count; ++ii) { |
7384 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7384 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7385 } | 7385 } |
7386 glUniform1iv(real_location, count, temp.get()); | 7386 glUniform1iv(real_location, count, temp.get()); |
7387 } else { | 7387 } else { |
7388 glUniform1fv(real_location, count, value); | 7388 glUniform1fv(real_location, count, value); |
7389 } | 7389 } |
7390 } | 7390 } |
7391 | 7391 |
7392 void GLES2DecoderImpl::DoUniform2fv( | 7392 void GLES2DecoderImpl::DoUniform2fv( |
7393 GLint fake_location, GLsizei count, const GLfloat* value) { | 7393 GLint fake_location, GLsizei count, const GLfloat* value) { |
7394 GLenum type = 0; | 7394 GLenum type = 0; |
7395 GLint real_location = -1; | 7395 GLint real_location = -1; |
7396 if (!PrepForSetUniformByLocation(fake_location, | 7396 if (!PrepForSetUniformByLocation(fake_location, |
7397 "glUniform2fv", | 7397 "glUniform2fv", |
7398 Program::kUniform2f, | 7398 Program::kUniform2f, |
7399 &real_location, | 7399 &real_location, |
7400 &type, | 7400 &type, |
7401 &count)) { | 7401 &count)) { |
7402 return; | 7402 return; |
7403 } | 7403 } |
7404 if (type == GL_BOOL_VEC2) { | 7404 if (type == GL_BOOL_VEC2) { |
7405 GLsizei num_values = count * 2; | 7405 GLsizei num_values = count * 2; |
7406 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 7406 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
7407 for (GLsizei ii = 0; ii < num_values; ++ii) { | 7407 for (GLsizei ii = 0; ii < num_values; ++ii) { |
7408 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7408 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7409 } | 7409 } |
7410 glUniform2iv(real_location, count, temp.get()); | 7410 glUniform2iv(real_location, count, temp.get()); |
7411 } else { | 7411 } else { |
7412 glUniform2fv(real_location, count, value); | 7412 glUniform2fv(real_location, count, value); |
7413 } | 7413 } |
7414 } | 7414 } |
7415 | 7415 |
7416 void GLES2DecoderImpl::DoUniform3fv( | 7416 void GLES2DecoderImpl::DoUniform3fv( |
7417 GLint fake_location, GLsizei count, const GLfloat* value) { | 7417 GLint fake_location, GLsizei count, const GLfloat* value) { |
7418 GLenum type = 0; | 7418 GLenum type = 0; |
7419 GLint real_location = -1; | 7419 GLint real_location = -1; |
7420 if (!PrepForSetUniformByLocation(fake_location, | 7420 if (!PrepForSetUniformByLocation(fake_location, |
7421 "glUniform3fv", | 7421 "glUniform3fv", |
7422 Program::kUniform3f, | 7422 Program::kUniform3f, |
7423 &real_location, | 7423 &real_location, |
7424 &type, | 7424 &type, |
7425 &count)) { | 7425 &count)) { |
7426 return; | 7426 return; |
7427 } | 7427 } |
7428 if (type == GL_BOOL_VEC3) { | 7428 if (type == GL_BOOL_VEC3) { |
7429 GLsizei num_values = count * 3; | 7429 GLsizei num_values = count * 3; |
7430 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 7430 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
7431 for (GLsizei ii = 0; ii < num_values; ++ii) { | 7431 for (GLsizei ii = 0; ii < num_values; ++ii) { |
7432 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7432 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7433 } | 7433 } |
7434 glUniform3iv(real_location, count, temp.get()); | 7434 glUniform3iv(real_location, count, temp.get()); |
7435 } else { | 7435 } else { |
7436 glUniform3fv(real_location, count, value); | 7436 glUniform3fv(real_location, count, value); |
7437 } | 7437 } |
7438 } | 7438 } |
7439 | 7439 |
7440 void GLES2DecoderImpl::DoUniform4fv( | 7440 void GLES2DecoderImpl::DoUniform4fv( |
7441 GLint fake_location, GLsizei count, const GLfloat* value) { | 7441 GLint fake_location, GLsizei count, const GLfloat* value) { |
7442 GLenum type = 0; | 7442 GLenum type = 0; |
7443 GLint real_location = -1; | 7443 GLint real_location = -1; |
7444 if (!PrepForSetUniformByLocation(fake_location, | 7444 if (!PrepForSetUniformByLocation(fake_location, |
7445 "glUniform4fv", | 7445 "glUniform4fv", |
7446 Program::kUniform4f, | 7446 Program::kUniform4f, |
7447 &real_location, | 7447 &real_location, |
7448 &type, | 7448 &type, |
7449 &count)) { | 7449 &count)) { |
7450 return; | 7450 return; |
7451 } | 7451 } |
7452 if (type == GL_BOOL_VEC4) { | 7452 if (type == GL_BOOL_VEC4) { |
7453 GLsizei num_values = count * 4; | 7453 GLsizei num_values = count * 4; |
7454 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 7454 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
7455 for (GLsizei ii = 0; ii < num_values; ++ii) { | 7455 for (GLsizei ii = 0; ii < num_values; ++ii) { |
7456 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); | 7456 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
7457 } | 7457 } |
7458 glUniform4iv(real_location, count, temp.get()); | 7458 glUniform4iv(real_location, count, temp.get()); |
7459 } else { | 7459 } else { |
7460 glUniform4fv(real_location, count, value); | 7460 glUniform4fv(real_location, count, value); |
7461 } | 7461 } |
7462 } | 7462 } |
7463 | 7463 |
7464 void GLES2DecoderImpl::DoUniform2iv( | 7464 void GLES2DecoderImpl::DoUniform2iv( |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8173 LOCAL_SET_GL_ERROR( | 8173 LOCAL_SET_GL_ERROR( |
8174 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); | 8174 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); |
8175 return false; | 8175 return false; |
8176 } | 8176 } |
8177 if (attrib_info && | 8177 if (attrib_info && |
8178 attrib->CanAccess(max_accessed) && | 8178 attrib->CanAccess(max_accessed) && |
8179 attrib->type() == GL_FIXED) { | 8179 attrib->type() == GL_FIXED) { |
8180 int num_elements = attrib->size() * num_vertices; | 8180 int num_elements = attrib->size() * num_vertices; |
8181 const int src_size = num_elements * sizeof(int32_t); | 8181 const int src_size = num_elements * sizeof(int32_t); |
8182 const int dst_size = num_elements * sizeof(float); | 8182 const int dst_size = num_elements * sizeof(float); |
8183 scoped_ptr<float[]> data(new float[num_elements]); | 8183 std::unique_ptr<float[]> data(new float[num_elements]); |
8184 const int32_t* src = reinterpret_cast<const int32_t*>( | 8184 const int32_t* src = reinterpret_cast<const int32_t*>( |
8185 attrib->buffer()->GetRange(attrib->offset(), src_size)); | 8185 attrib->buffer()->GetRange(attrib->offset(), src_size)); |
8186 const int32_t* end = src + num_elements; | 8186 const int32_t* end = src + num_elements; |
8187 float* dst = data.get(); | 8187 float* dst = data.get(); |
8188 while (src != end) { | 8188 while (src != end) { |
8189 *dst++ = static_cast<float>(*src++) / 65536.0f; | 8189 *dst++ = static_cast<float>(*src++) / 65536.0f; |
8190 } | 8190 } |
8191 glBufferSubData(GL_ARRAY_BUFFER, offset, dst_size, data.get()); | 8191 glBufferSubData(GL_ARRAY_BUFFER, offset, dst_size, data.get()); |
8192 glVertexAttribPointer( | 8192 glVertexAttribPointer( |
8193 attrib->index(), attrib->size(), GL_FLOAT, false, 0, | 8193 attrib->index(), attrib->size(), GL_FLOAT, false, 0, |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9561 int32_t max_y; | 9561 int32_t max_y; |
9562 if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y)) { | 9562 if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y)) { |
9563 LOCAL_SET_GL_ERROR( | 9563 LOCAL_SET_GL_ERROR( |
9564 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); | 9564 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); |
9565 return error::kNoError; | 9565 return error::kNoError; |
9566 } | 9566 } |
9567 | 9567 |
9568 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glReadPixels"); | 9568 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glReadPixels"); |
9569 | 9569 |
9570 ScopedResolvedFrameBufferBinder binder(this, false, true); | 9570 ScopedResolvedFrameBufferBinder binder(this, false, true); |
9571 scoped_ptr<ScopedFrameBufferReadPixelHelper> helper; | 9571 std::unique_ptr<ScopedFrameBufferReadPixelHelper> helper; |
9572 if (NeedsIOSurfaceReadbackWorkaround()) | 9572 if (NeedsIOSurfaceReadbackWorkaround()) |
9573 helper.reset(new ScopedFrameBufferReadPixelHelper(&state_, this)); | 9573 helper.reset(new ScopedFrameBufferReadPixelHelper(&state_, this)); |
9574 | 9574 |
9575 gfx::Rect rect(x, y, width, height); // Safe before we checked above. | 9575 gfx::Rect rect(x, y, width, height); // Safe before we checked above. |
9576 gfx::Rect max_rect(max_size); | 9576 gfx::Rect max_rect(max_size); |
9577 if (!max_rect.Contains(rect)) { | 9577 if (!max_rect.Contains(rect)) { |
9578 rect.Intersect(max_rect); | 9578 rect.Intersect(max_rect); |
9579 if (!rect.IsEmpty()) { | 9579 if (!rect.IsEmpty()) { |
9580 if (y < 0) { | 9580 if (y < 0) { |
9581 pixels += static_cast<uint32_t>(-y) * padded_row_size;; | 9581 pixels += static_cast<uint32_t>(-y) * padded_row_size;; |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10360 if (!GLES2Util::ComputeImageDataSizes( | 10360 if (!GLES2Util::ComputeImageDataSizes( |
10361 width, tile_height, 1, format, type, state_.unpack_alignment, &size, | 10361 width, tile_height, 1, format, type, state_.unpack_alignment, &size, |
10362 NULL, NULL)) { | 10362 NULL, NULL)) { |
10363 return false; | 10363 return false; |
10364 } | 10364 } |
10365 } else { | 10365 } else { |
10366 tile_height = height; | 10366 tile_height = height; |
10367 } | 10367 } |
10368 | 10368 |
10369 // Assumes the size has already been checked. | 10369 // Assumes the size has already been checked. |
10370 scoped_ptr<char[]> zero(new char[size]); | 10370 std::unique_ptr<char[]> zero(new char[size]); |
10371 memset(zero.get(), 0, size); | 10371 memset(zero.get(), 0, size); |
10372 glBindTexture(texture->target(), texture->service_id()); | 10372 glBindTexture(texture->target(), texture->service_id()); |
10373 | 10373 |
10374 GLint y = 0; | 10374 GLint y = 0; |
10375 while (y < height) { | 10375 while (y < height) { |
10376 GLint h = y + tile_height > height ? height - y : tile_height; | 10376 GLint h = y + tile_height > height ? height - y : tile_height; |
10377 glTexSubImage2D(target, level, xoffset, yoffset + y, width, h, format, type, | 10377 glTexSubImage2D(target, level, xoffset, yoffset + y, width, h, format, type, |
10378 zero.get()); | 10378 zero.get()); |
10379 y += tile_height; | 10379 y += tile_height; |
10380 } | 10380 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10472 | 10472 |
10473 TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearLevel3D", "size", size); | 10473 TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearLevel3D", "size", size); |
10474 | 10474 |
10475 GLuint buffer_id = 0; | 10475 GLuint buffer_id = 0; |
10476 glGenBuffersARB(1, &buffer_id); | 10476 glGenBuffersARB(1, &buffer_id); |
10477 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer_id); | 10477 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer_id); |
10478 { | 10478 { |
10479 // Include padding as some drivers incorrectly requires padding for the | 10479 // Include padding as some drivers incorrectly requires padding for the |
10480 // last row. | 10480 // last row. |
10481 buffer_size += padding; | 10481 buffer_size += padding; |
10482 scoped_ptr<char[]> zero(new char[buffer_size]); | 10482 std::unique_ptr<char[]> zero(new char[buffer_size]); |
10483 memset(zero.get(), 0, buffer_size); | 10483 memset(zero.get(), 0, buffer_size); |
10484 // TODO(zmo): Consider glMapBufferRange instead. | 10484 // TODO(zmo): Consider glMapBufferRange instead. |
10485 glBufferData( | 10485 glBufferData( |
10486 GL_PIXEL_UNPACK_BUFFER, buffer_size, zero.get(), GL_STATIC_DRAW); | 10486 GL_PIXEL_UNPACK_BUFFER, buffer_size, zero.get(), GL_STATIC_DRAW); |
10487 } | 10487 } |
10488 | 10488 |
10489 Buffer* bound_buffer = buffer_manager()->GetBufferInfoForTarget( | 10489 Buffer* bound_buffer = buffer_manager()->GetBufferInfoForTarget( |
10490 &state_, GL_PIXEL_UNPACK_BUFFER); | 10490 &state_, GL_PIXEL_UNPACK_BUFFER); |
10491 if (bound_buffer) { | 10491 if (bound_buffer) { |
10492 // If an unpack buffer is bound, we need to clear unpack parameters | 10492 // 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... |
10982 if (!EnsureGPUMemoryAvailable(image_size)) { | 10982 if (!EnsureGPUMemoryAvailable(image_size)) { |
10983 LOCAL_SET_GL_ERROR( | 10983 LOCAL_SET_GL_ERROR( |
10984 GL_OUT_OF_MEMORY, "glCompressedTexImage2D", "out of memory"); | 10984 GL_OUT_OF_MEMORY, "glCompressedTexImage2D", "out of memory"); |
10985 return error::kNoError; | 10985 return error::kNoError; |
10986 } | 10986 } |
10987 | 10987 |
10988 if (texture->IsAttachedToFramebuffer()) { | 10988 if (texture->IsAttachedToFramebuffer()) { |
10989 framebuffer_state_.clear_state_dirty = true; | 10989 framebuffer_state_.clear_state_dirty = true; |
10990 } | 10990 } |
10991 | 10991 |
10992 scoped_ptr<int8_t[]> zero; | 10992 std::unique_ptr<int8_t[]> zero; |
10993 if (!data) { | 10993 if (!data) { |
10994 zero.reset(new int8_t[image_size]); | 10994 zero.reset(new int8_t[image_size]); |
10995 memset(zero.get(), 0, image_size); | 10995 memset(zero.get(), 0, image_size); |
10996 data = zero.get(); | 10996 data = zero.get(); |
10997 } | 10997 } |
10998 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage2D"); | 10998 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage2D"); |
10999 glCompressedTexImage2D( | 10999 glCompressedTexImage2D( |
11000 target, level, internal_format, width, height, border, image_size, data); | 11000 target, level, internal_format, width, height, border, image_size, data); |
11001 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D"); | 11001 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D"); |
11002 if (error == GL_NO_ERROR) { | 11002 if (error == GL_NO_ERROR) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11177 if (!EnsureGPUMemoryAvailable(image_size)) { | 11177 if (!EnsureGPUMemoryAvailable(image_size)) { |
11178 LOCAL_SET_GL_ERROR( | 11178 LOCAL_SET_GL_ERROR( |
11179 GL_OUT_OF_MEMORY, "glCompressedTexImage3D", "out of memory"); | 11179 GL_OUT_OF_MEMORY, "glCompressedTexImage3D", "out of memory"); |
11180 return error::kNoError; | 11180 return error::kNoError; |
11181 } | 11181 } |
11182 | 11182 |
11183 if (texture->IsAttachedToFramebuffer()) { | 11183 if (texture->IsAttachedToFramebuffer()) { |
11184 framebuffer_state_.clear_state_dirty = true; | 11184 framebuffer_state_.clear_state_dirty = true; |
11185 } | 11185 } |
11186 | 11186 |
11187 scoped_ptr<int8_t[]> zero; | 11187 std::unique_ptr<int8_t[]> zero; |
11188 if (!data) { | 11188 if (!data) { |
11189 zero.reset(new int8_t[image_size]); | 11189 zero.reset(new int8_t[image_size]); |
11190 memset(zero.get(), 0, image_size); | 11190 memset(zero.get(), 0, image_size); |
11191 data = zero.get(); | 11191 data = zero.get(); |
11192 } | 11192 } |
11193 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage3D"); | 11193 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage3D"); |
11194 glCompressedTexImage3D(target, level, internal_format, width, height, depth, | 11194 glCompressedTexImage3D(target, level, internal_format, width, height, depth, |
11195 border, image_size, data); | 11195 border, image_size, data); |
11196 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage3D"); | 11196 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage3D"); |
11197 if (error == GL_NO_ERROR) { | 11197 if (error == GL_NO_ERROR) { |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11743 GLint copyWidth = 0; | 11743 GLint copyWidth = 0; |
11744 GLint copyHeight = 0; | 11744 GLint copyHeight = 0; |
11745 Clip(x, width, size.width(), ©X, ©Width); | 11745 Clip(x, width, size.width(), ©X, ©Width); |
11746 Clip(y, height, size.height(), ©Y, ©Height); | 11746 Clip(y, height, size.height(), ©Y, ©Height); |
11747 | 11747 |
11748 if (copyX != x || | 11748 if (copyX != x || |
11749 copyY != y || | 11749 copyY != y || |
11750 copyWidth != width || | 11750 copyWidth != width || |
11751 copyHeight != height) { | 11751 copyHeight != height) { |
11752 // some part was clipped so clear the rect. | 11752 // some part was clipped so clear the rect. |
11753 scoped_ptr<char[]> zero(new char[pixels_size]); | 11753 std::unique_ptr<char[]> zero(new char[pixels_size]); |
11754 memset(zero.get(), 0, pixels_size); | 11754 memset(zero.get(), 0, pixels_size); |
11755 glTexImage2D(target, level, | 11755 glTexImage2D(target, level, |
11756 texture_manager()->AdjustTexInternalFormat(internal_format), | 11756 texture_manager()->AdjustTexInternalFormat(internal_format), |
11757 width, height, border, format, type, zero.get()); | 11757 width, height, border, format, type, zero.get()); |
11758 if (copyHeight > 0 && copyWidth > 0) { | 11758 if (copyHeight > 0 && copyWidth > 0) { |
11759 GLint dx = copyX - x; | 11759 GLint dx = copyX - x; |
11760 GLint dy = copyY - y; | 11760 GLint dy = copyY - y; |
11761 GLint destX = dx; | 11761 GLint destX = dx; |
11762 GLint destY = dy; | 11762 GLint destY = dy; |
11763 glCopyTexSubImage2D(target, level, | 11763 glCopyTexSubImage2D(target, level, |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12265 cmds::GetUniformfv::Result* result; | 12265 cmds::GetUniformfv::Result* result; |
12266 GLenum result_type; | 12266 GLenum result_type; |
12267 GLsizei result_size; | 12267 GLsizei result_size; |
12268 if (GetUniformSetup<GLfloat>(program, fake_location, c.params_shm_id, | 12268 if (GetUniformSetup<GLfloat>(program, fake_location, c.params_shm_id, |
12269 c.params_shm_offset, &error, &real_location, | 12269 c.params_shm_offset, &error, &real_location, |
12270 &service_id, &result, &result_type, | 12270 &service_id, &result, &result_type, |
12271 &result_size)) { | 12271 &result_size)) { |
12272 if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || | 12272 if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || |
12273 result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { | 12273 result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { |
12274 GLsizei num_values = result_size / sizeof(GLfloat); | 12274 GLsizei num_values = result_size / sizeof(GLfloat); |
12275 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 12275 std::unique_ptr<GLint[]> temp(new GLint[num_values]); |
12276 glGetUniformiv(service_id, real_location, temp.get()); | 12276 glGetUniformiv(service_id, real_location, temp.get()); |
12277 GLfloat* dst = result->GetData(); | 12277 GLfloat* dst = result->GetData(); |
12278 for (GLsizei ii = 0; ii < num_values; ++ii) { | 12278 for (GLsizei ii = 0; ii < num_values; ++ii) { |
12279 dst[ii] = (temp[ii] != 0); | 12279 dst[ii] = (temp[ii] != 0); |
12280 } | 12280 } |
12281 } else { | 12281 } else { |
12282 glGetUniformfv(service_id, real_location, result->GetData()); | 12282 glGetUniformfv(service_id, real_location, result->GetData()); |
12283 } | 12283 } |
12284 } | 12284 } |
12285 return error; | 12285 return error; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12626 return error::kOutOfBounds; | 12626 return error::kOutOfBounds; |
12627 } | 12627 } |
12628 const GLuint* shaders = GetSharedMemoryAs<const GLuint*>( | 12628 const GLuint* shaders = GetSharedMemoryAs<const GLuint*>( |
12629 c.shaders_shm_id, c.shaders_shm_offset, data_size); | 12629 c.shaders_shm_id, c.shaders_shm_offset, data_size); |
12630 GLenum binaryformat = static_cast<GLenum>(c.binaryformat); | 12630 GLenum binaryformat = static_cast<GLenum>(c.binaryformat); |
12631 const void* binary = GetSharedMemoryAs<const void*>( | 12631 const void* binary = GetSharedMemoryAs<const void*>( |
12632 c.binary_shm_id, c.binary_shm_offset, length); | 12632 c.binary_shm_id, c.binary_shm_offset, length); |
12633 if (shaders == NULL || binary == NULL) { | 12633 if (shaders == NULL || binary == NULL) { |
12634 return error::kOutOfBounds; | 12634 return error::kOutOfBounds; |
12635 } | 12635 } |
12636 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 12636 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
12637 for (GLsizei ii = 0; ii < n; ++ii) { | 12637 for (GLsizei ii = 0; ii < n; ++ii) { |
12638 Shader* shader = GetShader(shaders[ii]); | 12638 Shader* shader = GetShader(shaders[ii]); |
12639 if (!shader) { | 12639 if (!shader) { |
12640 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "unknown shader"); | 12640 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "unknown shader"); |
12641 return error::kNoError; | 12641 return error::kNoError; |
12642 } | 12642 } |
12643 service_ids[ii] = shader->service_id(); | 12643 service_ids[ii] = shader->service_id(); |
12644 } | 12644 } |
12645 // TODO(gman): call glShaderBinary | 12645 // TODO(gman): call glShaderBinary |
12646 return error::kNoError; | 12646 return error::kNoError; |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13465 return false; | 13465 return false; |
13466 } | 13466 } |
13467 } | 13467 } |
13468 | 13468 |
13469 if (!features().native_vertex_array_object) { | 13469 if (!features().native_vertex_array_object) { |
13470 // Emulated VAO | 13470 // Emulated VAO |
13471 for (GLsizei ii = 0; ii < n; ++ii) { | 13471 for (GLsizei ii = 0; ii < n; ++ii) { |
13472 CreateVertexAttribManager(client_ids[ii], 0, true); | 13472 CreateVertexAttribManager(client_ids[ii], 0, true); |
13473 } | 13473 } |
13474 } else { | 13474 } else { |
13475 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 13475 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
13476 | 13476 |
13477 glGenVertexArraysOES(n, service_ids.get()); | 13477 glGenVertexArraysOES(n, service_ids.get()); |
13478 for (GLsizei ii = 0; ii < n; ++ii) { | 13478 for (GLsizei ii = 0; ii < n; ++ii) { |
13479 CreateVertexAttribManager(client_ids[ii], service_ids[ii], true); | 13479 CreateVertexAttribManager(client_ids[ii], service_ids[ii], true); |
13480 } | 13480 } |
13481 } | 13481 } |
13482 | 13482 |
13483 return true; | 13483 return true; |
13484 } | 13484 } |
13485 | 13485 |
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15346 transform_type, "transformType"); | 15346 transform_type, "transformType"); |
15347 return false; | 15347 return false; |
15348 } | 15348 } |
15349 *out_transform_type = transform_type; | 15349 *out_transform_type = transform_type; |
15350 return true; | 15350 return true; |
15351 } | 15351 } |
15352 template <typename Cmd> | 15352 template <typename Cmd> |
15353 bool GetPathNameData(const Cmd& cmd, | 15353 bool GetPathNameData(const Cmd& cmd, |
15354 GLuint num_paths, | 15354 GLuint num_paths, |
15355 GLenum path_name_type, | 15355 GLenum path_name_type, |
15356 scoped_ptr<GLuint[]>* out_buffer) { | 15356 std::unique_ptr<GLuint[]>* out_buffer) { |
15357 DCHECK(validators_->path_name_type.IsValid(path_name_type)); | 15357 DCHECK(validators_->path_name_type.IsValid(path_name_type)); |
15358 GLuint path_base = static_cast<GLuint>(cmd.pathBase); | 15358 GLuint path_base = static_cast<GLuint>(cmd.pathBase); |
15359 uint32_t shm_id = static_cast<uint32_t>(cmd.paths_shm_id); | 15359 uint32_t shm_id = static_cast<uint32_t>(cmd.paths_shm_id); |
15360 uint32_t shm_offset = static_cast<uint32_t>(cmd.paths_shm_offset); | 15360 uint32_t shm_offset = static_cast<uint32_t>(cmd.paths_shm_offset); |
15361 if (shm_id == 0 && shm_offset == 0) { | 15361 if (shm_id == 0 && shm_offset == 0) { |
15362 error_ = error::kOutOfBounds; | 15362 error_ = error::kOutOfBounds; |
15363 return false; | 15363 return false; |
15364 } | 15364 } |
15365 switch (path_name_type) { | 15365 switch (path_name_type) { |
15366 case GL_BYTE: | 15366 case GL_BYTE: |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15433 *out_cover_mode = cover_mode; | 15433 *out_cover_mode = cover_mode; |
15434 return true; | 15434 return true; |
15435 } | 15435 } |
15436 | 15436 |
15437 private: | 15437 private: |
15438 template <typename T> | 15438 template <typename T> |
15439 bool GetPathNameDataImpl(GLuint num_paths, | 15439 bool GetPathNameDataImpl(GLuint num_paths, |
15440 GLuint path_base, | 15440 GLuint path_base, |
15441 uint32_t shm_id, | 15441 uint32_t shm_id, |
15442 uint32_t shm_offset, | 15442 uint32_t shm_offset, |
15443 scoped_ptr<GLuint[]>* out_buffer) { | 15443 std::unique_ptr<GLuint[]>* out_buffer) { |
15444 uint32_t paths_size = 0; | 15444 uint32_t paths_size = 0; |
15445 if (!SafeMultiplyUint32(num_paths, sizeof(T), &paths_size)) { | 15445 if (!SafeMultiplyUint32(num_paths, sizeof(T), &paths_size)) { |
15446 error_ = error::kOutOfBounds; | 15446 error_ = error::kOutOfBounds; |
15447 return false; | 15447 return false; |
15448 } | 15448 } |
15449 T* paths = decoder_->GetSharedMemoryAs<T*>(shm_id, shm_offset, paths_size); | 15449 T* paths = decoder_->GetSharedMemoryAs<T*>(shm_id, shm_offset, paths_size); |
15450 if (!paths) { | 15450 if (!paths) { |
15451 error_ = error::kOutOfBounds; | 15451 error_ = error::kOutOfBounds; |
15452 return false; | 15452 return false; |
15453 } | 15453 } |
15454 scoped_ptr<GLuint[]> result_paths(new GLuint[num_paths]); | 15454 std::unique_ptr<GLuint[]> result_paths(new GLuint[num_paths]); |
15455 bool has_paths = false; | 15455 bool has_paths = false; |
15456 for (GLuint i = 0; i < num_paths; ++i) { | 15456 for (GLuint i = 0; i < num_paths; ++i) { |
15457 GLuint service_id = 0; | 15457 GLuint service_id = 0; |
15458 // The below addition is ok even with over- and underflows. | 15458 // The below addition is ok even with over- and underflows. |
15459 // There is no difference if client passes: | 15459 // There is no difference if client passes: |
15460 // * base==4, T=GLbyte, paths[0]==0xfa (-6) | 15460 // * base==4, T=GLbyte, paths[0]==0xfa (-6) |
15461 // * base==0xffffffff, T=GLuint, paths[0]==0xffffffff | 15461 // * base==0xffffffff, T=GLuint, paths[0]==0xffffffff |
15462 // * base==0, T=GLuint, paths[0]==0xfffffffe | 15462 // * base==0, T=GLuint, paths[0]==0xfffffffe |
15463 // For the all the cases, the interpretation is that | 15463 // For the all the cases, the interpretation is that |
15464 // client intends to use the path 0xfffffffe. | 15464 // client intends to use the path 0xfffffffe. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15559 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCoords < 0"); | 15559 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCoords < 0"); |
15560 return error::kNoError; | 15560 return error::kNoError; |
15561 } | 15561 } |
15562 | 15562 |
15563 GLenum coord_type = static_cast<uint32_t>(c.coordType); | 15563 GLenum coord_type = static_cast<uint32_t>(c.coordType); |
15564 if (!validators_->path_coord_type.IsValid(static_cast<GLint>(coord_type))) { | 15564 if (!validators_->path_coord_type.IsValid(static_cast<GLint>(coord_type))) { |
15565 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName, "invalid coordType"); | 15565 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName, "invalid coordType"); |
15566 return error::kNoError; | 15566 return error::kNoError; |
15567 } | 15567 } |
15568 | 15568 |
15569 scoped_ptr<GLubyte[]> commands; | 15569 std::unique_ptr<GLubyte[]> commands; |
15570 base::CheckedNumeric<GLsizei> num_coords_expected = 0; | 15570 base::CheckedNumeric<GLsizei> num_coords_expected = 0; |
15571 | 15571 |
15572 if (num_commands > 0) { | 15572 if (num_commands > 0) { |
15573 uint32_t commands_shm_id = static_cast<uint32_t>(c.commands_shm_id); | 15573 uint32_t commands_shm_id = static_cast<uint32_t>(c.commands_shm_id); |
15574 uint32_t commands_shm_offset = static_cast<uint32_t>(c.commands_shm_offset); | 15574 uint32_t commands_shm_offset = static_cast<uint32_t>(c.commands_shm_offset); |
15575 if (commands_shm_id != 0 || commands_shm_offset != 0) { | 15575 if (commands_shm_id != 0 || commands_shm_offset != 0) { |
15576 const GLubyte* shared_commands = GetSharedMemoryAs<const GLubyte*>( | 15576 const GLubyte* shared_commands = GetSharedMemoryAs<const GLubyte*>( |
15577 commands_shm_id, commands_shm_offset, num_commands); | 15577 commands_shm_id, commands_shm_offset, num_commands); |
15578 if (shared_commands) { | 15578 if (shared_commands) { |
15579 commands.reset(new GLubyte[num_commands]); | 15579 commands.reset(new GLubyte[num_commands]); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15897 GLuint mask = 0; | 15897 GLuint mask = 0; |
15898 GLenum transform_type = GL_NONE; | 15898 GLenum transform_type = GL_NONE; |
15899 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 15899 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
15900 !v.GetFillModeAndMask(c, &fill_mode, &mask) || | 15900 !v.GetFillModeAndMask(c, &fill_mode, &mask) || |
15901 !v.GetTransformType(c, &transform_type)) | 15901 !v.GetTransformType(c, &transform_type)) |
15902 return v.error(); | 15902 return v.error(); |
15903 | 15903 |
15904 if (num_paths == 0) | 15904 if (num_paths == 0) |
15905 return error::kNoError; | 15905 return error::kNoError; |
15906 | 15906 |
15907 scoped_ptr<GLuint[]> paths; | 15907 std::unique_ptr<GLuint[]> paths; |
15908 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 15908 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
15909 return v.error(); | 15909 return v.error(); |
15910 | 15910 |
15911 const GLfloat* transforms = nullptr; | 15911 const GLfloat* transforms = nullptr; |
15912 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 15912 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
15913 return v.error(); | 15913 return v.error(); |
15914 | 15914 |
15915 ApplyDirtyState(); | 15915 ApplyDirtyState(); |
15916 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, | 15916 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, |
15917 fill_mode, mask, transform_type, transforms); | 15917 fill_mode, mask, transform_type, transforms); |
(...skipping 13 matching lines...) Expand all Loading... |
15931 GLuint num_paths = 0; | 15931 GLuint num_paths = 0; |
15932 GLenum path_name_type = GL_NONE; | 15932 GLenum path_name_type = GL_NONE; |
15933 GLenum transform_type = GL_NONE; | 15933 GLenum transform_type = GL_NONE; |
15934 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 15934 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
15935 !v.GetTransformType(c, &transform_type)) | 15935 !v.GetTransformType(c, &transform_type)) |
15936 return v.error(); | 15936 return v.error(); |
15937 | 15937 |
15938 if (num_paths == 0) | 15938 if (num_paths == 0) |
15939 return error::kNoError; | 15939 return error::kNoError; |
15940 | 15940 |
15941 scoped_ptr<GLuint[]> paths; | 15941 std::unique_ptr<GLuint[]> paths; |
15942 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 15942 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
15943 return v.error(); | 15943 return v.error(); |
15944 | 15944 |
15945 const GLfloat* transforms = nullptr; | 15945 const GLfloat* transforms = nullptr; |
15946 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 15946 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
15947 return v.error(); | 15947 return v.error(); |
15948 | 15948 |
15949 GLint reference = static_cast<GLint>(c.reference); | 15949 GLint reference = static_cast<GLint>(c.reference); |
15950 GLuint mask = static_cast<GLuint>(c.mask); | 15950 GLuint mask = static_cast<GLuint>(c.mask); |
15951 ApplyDirtyState(); | 15951 ApplyDirtyState(); |
(...skipping 17 matching lines...) Expand all Loading... |
15969 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; | 15969 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; |
15970 GLenum transform_type = GL_NONE; | 15970 GLenum transform_type = GL_NONE; |
15971 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 15971 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
15972 !v.GetCoverMode(c, &cover_mode) || | 15972 !v.GetCoverMode(c, &cover_mode) || |
15973 !v.GetTransformType(c, &transform_type)) | 15973 !v.GetTransformType(c, &transform_type)) |
15974 return v.error(); | 15974 return v.error(); |
15975 | 15975 |
15976 if (num_paths == 0) | 15976 if (num_paths == 0) |
15977 return error::kNoError; | 15977 return error::kNoError; |
15978 | 15978 |
15979 scoped_ptr<GLuint[]> paths; | 15979 std::unique_ptr<GLuint[]> paths; |
15980 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 15980 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
15981 return v.error(); | 15981 return v.error(); |
15982 | 15982 |
15983 const GLfloat* transforms = nullptr; | 15983 const GLfloat* transforms = nullptr; |
15984 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 15984 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
15985 return v.error(); | 15985 return v.error(); |
15986 | 15986 |
15987 ApplyDirtyState(); | 15987 ApplyDirtyState(); |
15988 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, | 15988 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, |
15989 cover_mode, transform_type, transforms); | 15989 cover_mode, transform_type, transforms); |
(...skipping 15 matching lines...) Expand all Loading... |
16005 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; | 16005 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; |
16006 GLenum transform_type = GL_NONE; | 16006 GLenum transform_type = GL_NONE; |
16007 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 16007 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
16008 !v.GetCoverMode(c, &cover_mode) || | 16008 !v.GetCoverMode(c, &cover_mode) || |
16009 !v.GetTransformType(c, &transform_type)) | 16009 !v.GetTransformType(c, &transform_type)) |
16010 return v.error(); | 16010 return v.error(); |
16011 | 16011 |
16012 if (num_paths == 0) | 16012 if (num_paths == 0) |
16013 return error::kNoError; | 16013 return error::kNoError; |
16014 | 16014 |
16015 scoped_ptr<GLuint[]> paths; | 16015 std::unique_ptr<GLuint[]> paths; |
16016 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16016 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16017 return v.error(); | 16017 return v.error(); |
16018 | 16018 |
16019 const GLfloat* transforms = nullptr; | 16019 const GLfloat* transforms = nullptr; |
16020 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16020 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16021 return v.error(); | 16021 return v.error(); |
16022 | 16022 |
16023 ApplyDirtyState(); | 16023 ApplyDirtyState(); |
16024 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, | 16024 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, |
16025 cover_mode, transform_type, transforms); | 16025 cover_mode, transform_type, transforms); |
(...skipping 19 matching lines...) Expand all Loading... |
16045 GLenum transform_type = GL_NONE; | 16045 GLenum transform_type = GL_NONE; |
16046 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 16046 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
16047 !v.GetFillModeAndMask(c, &fill_mode, &mask) || | 16047 !v.GetFillModeAndMask(c, &fill_mode, &mask) || |
16048 !v.GetCoverMode(c, &cover_mode) || | 16048 !v.GetCoverMode(c, &cover_mode) || |
16049 !v.GetTransformType(c, &transform_type)) | 16049 !v.GetTransformType(c, &transform_type)) |
16050 return v.error(); | 16050 return v.error(); |
16051 | 16051 |
16052 if (num_paths == 0) | 16052 if (num_paths == 0) |
16053 return error::kNoError; | 16053 return error::kNoError; |
16054 | 16054 |
16055 scoped_ptr<GLuint[]> paths; | 16055 std::unique_ptr<GLuint[]> paths; |
16056 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16056 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16057 return v.error(); | 16057 return v.error(); |
16058 | 16058 |
16059 const GLfloat* transforms = nullptr; | 16059 const GLfloat* transforms = nullptr; |
16060 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16060 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16061 return v.error(); | 16061 return v.error(); |
16062 | 16062 |
16063 ApplyDirtyState(); | 16063 ApplyDirtyState(); |
16064 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), | 16064 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), |
16065 0, fill_mode, mask, cover_mode, | 16065 0, fill_mode, mask, cover_mode, |
(...skipping 18 matching lines...) Expand all Loading... |
16084 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; | 16084 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; |
16085 GLenum transform_type = GL_NONE; | 16085 GLenum transform_type = GL_NONE; |
16086 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || | 16086 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || |
16087 !v.GetCoverMode(c, &cover_mode) || | 16087 !v.GetCoverMode(c, &cover_mode) || |
16088 !v.GetTransformType(c, &transform_type)) | 16088 !v.GetTransformType(c, &transform_type)) |
16089 return v.error(); | 16089 return v.error(); |
16090 | 16090 |
16091 if (num_paths == 0) | 16091 if (num_paths == 0) |
16092 return error::kNoError; | 16092 return error::kNoError; |
16093 | 16093 |
16094 scoped_ptr<GLuint[]> paths; | 16094 std::unique_ptr<GLuint[]> paths; |
16095 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) | 16095 if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) |
16096 return v.error(); | 16096 return v.error(); |
16097 | 16097 |
16098 const GLfloat* transforms = nullptr; | 16098 const GLfloat* transforms = nullptr; |
16099 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 16099 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
16100 return v.error(); | 16100 return v.error(); |
16101 | 16101 |
16102 GLint reference = static_cast<GLint>(c.reference); | 16102 GLint reference = static_cast<GLint>(c.reference); |
16103 GLuint mask = static_cast<GLuint>(c.mask); | 16103 GLuint mask = static_cast<GLuint>(c.mask); |
16104 ApplyDirtyState(); | 16104 ApplyDirtyState(); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16376 } | 16376 } |
16377 | 16377 |
16378 // Include the auto-generated part of this file. We split this because it means | 16378 // Include the auto-generated part of this file. We split this because it means |
16379 // we can easily edit the non-auto generated parts right here in this file | 16379 // we can easily edit the non-auto generated parts right here in this file |
16380 // instead of having to edit some template or the code generator. | 16380 // instead of having to edit some template or the code generator. |
16381 #include "base/macros.h" | 16381 #include "base/macros.h" |
16382 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16382 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
16383 | 16383 |
16384 } // namespace gles2 | 16384 } // namespace gles2 |
16385 } // namespace gpu | 16385 } // namespace gpu |
OLD | NEW |