Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(678)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2061743004: Implement native GMB backbuffers in the GLES2 Command Decoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile error on Windows. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 30 matching lines...) Expand all
41 #include "gpu/command_buffer/service/gl_utils.h" 41 #include "gpu/command_buffer/service/gl_utils.h"
42 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa _intel.h" 42 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa _intel.h"
43 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" 43 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h"
44 #include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.h" 44 #include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.h"
45 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" 45 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
46 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" 46 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h"
47 #include "gpu/command_buffer/service/gles2_cmd_validation.h" 47 #include "gpu/command_buffer/service/gles2_cmd_validation.h"
48 #include "gpu/command_buffer/service/gpu_preferences.h" 48 #include "gpu/command_buffer/service/gpu_preferences.h"
49 #include "gpu/command_buffer/service/gpu_state_tracer.h" 49 #include "gpu/command_buffer/service/gpu_state_tracer.h"
50 #include "gpu/command_buffer/service/gpu_tracer.h" 50 #include "gpu/command_buffer/service/gpu_tracer.h"
51 #include "gpu/command_buffer/service/image_factory.h"
51 #include "gpu/command_buffer/service/image_manager.h" 52 #include "gpu/command_buffer/service/image_manager.h"
52 #include "gpu/command_buffer/service/logger.h" 53 #include "gpu/command_buffer/service/logger.h"
53 #include "gpu/command_buffer/service/mailbox_manager.h" 54 #include "gpu/command_buffer/service/mailbox_manager.h"
54 #include "gpu/command_buffer/service/memory_tracking.h" 55 #include "gpu/command_buffer/service/memory_tracking.h"
55 #include "gpu/command_buffer/service/path_manager.h" 56 #include "gpu/command_buffer/service/path_manager.h"
56 #include "gpu/command_buffer/service/program_manager.h" 57 #include "gpu/command_buffer/service/program_manager.h"
57 #include "gpu/command_buffer/service/query_manager.h" 58 #include "gpu/command_buffer/service/query_manager.h"
58 #include "gpu/command_buffer/service/renderbuffer_manager.h" 59 #include "gpu/command_buffer/service/renderbuffer_manager.h"
59 #include "gpu/command_buffer/service/sampler_manager.h" 60 #include "gpu/command_buffer/service/sampler_manager.h"
60 #include "gpu/command_buffer/service/shader_manager.h" 61 #include "gpu/command_buffer/service/shader_manager.h"
61 #include "gpu/command_buffer/service/shader_translator.h" 62 #include "gpu/command_buffer/service/shader_translator.h"
62 #include "gpu/command_buffer/service/texture_manager.h" 63 #include "gpu/command_buffer/service/texture_manager.h"
63 #include "gpu/command_buffer/service/transform_feedback_manager.h" 64 #include "gpu/command_buffer/service/transform_feedback_manager.h"
64 #include "gpu/command_buffer/service/vertex_array_manager.h" 65 #include "gpu/command_buffer/service/vertex_array_manager.h"
65 #include "gpu/command_buffer/service/vertex_attrib_manager.h" 66 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
66 #include "third_party/smhasher/src/City.h" 67 #include "third_party/smhasher/src/City.h"
68 #include "ui/gfx/buffer_types.h"
67 #include "ui/gfx/geometry/point.h" 69 #include "ui/gfx/geometry/point.h"
68 #include "ui/gfx/geometry/rect.h" 70 #include "ui/gfx/geometry/rect.h"
69 #include "ui/gfx/geometry/size.h" 71 #include "ui/gfx/geometry/size.h"
72 #include "ui/gfx/gpu_memory_buffer.h"
70 #include "ui/gfx/overlay_transform.h" 73 #include "ui/gfx/overlay_transform.h"
71 #include "ui/gfx/transform.h" 74 #include "ui/gfx/transform.h"
72 #include "ui/gl/gl_bindings.h" 75 #include "ui/gl/gl_bindings.h"
73 #include "ui/gl/gl_context.h" 76 #include "ui/gl/gl_context.h"
74 #include "ui/gl/gl_fence.h" 77 #include "ui/gl/gl_fence.h"
75 #include "ui/gl/gl_image.h" 78 #include "ui/gl/gl_image.h"
76 #include "ui/gl/gl_implementation.h" 79 #include "ui/gl/gl_implementation.h"
77 #include "ui/gl/gl_surface.h" 80 #include "ui/gl/gl_surface.h"
78 #include "ui/gl/gl_version_info.h" 81 #include "ui/gl/gl_version_info.h"
79 #include "ui/gl/gpu_timing.h" 82 #include "ui/gl/gpu_timing.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 void Copy(const gfx::Size& size, GLenum format); 403 void Copy(const gfx::Size& size, GLenum format);
401 404
402 // Destroy the render texture. This must be explicitly called before 405 // Destroy the render texture. This must be explicitly called before
403 // destroying this object. 406 // destroying this object.
404 void Destroy(); 407 void Destroy();
405 408
406 // Invalidate the texture. This can be used when a context is lost and it is 409 // Invalidate the texture. This can be used when a context is lost and it is
407 // not possible to make it current in order to free the resource. 410 // not possible to make it current in order to free the resource.
408 void Invalidate(); 411 void Invalidate();
409 412
413 // The bind point for the texture.
414 GLenum Target();
415
410 scoped_refptr<TextureRef> texture_ref() { return texture_ref_; } 416 scoped_refptr<TextureRef> texture_ref() { return texture_ref_; }
411 417
412 GLuint id() const { 418 GLuint id() const {
413 return texture_ref_ ? texture_ref_->service_id() : 0; 419 return texture_ref_ ? texture_ref_->service_id() : 0;
414 } 420 }
415 421
416 gfx::Size size() const { 422 gfx::Size size() const {
417 return size_; 423 return size_;
418 } 424 }
419 425
420 private: 426 private:
427 // The texture must be bound to Target() before calling this method.
428 void AllocateNativeGpuMemoryBuffer(const gfx::Size& size,
429 GLenum format,
430 bool zero);
431
432 // The texture must be bound to Target() before calling this method.
433 void DestroyNativeGpuMemoryBuffer(bool have_context);
434
421 MemoryTypeTracker memory_tracker_; 435 MemoryTypeTracker memory_tracker_;
422 size_t bytes_allocated_; 436 size_t bytes_allocated_;
423 gfx::Size size_; 437 gfx::Size size_;
424 GLES2DecoderImpl* decoder_; 438 GLES2DecoderImpl* decoder_;
425 439
426 scoped_refptr<TextureRef> texture_ref_; 440 scoped_refptr<TextureRef> texture_ref_;
427 441
442 // The image that backs the texture, if its backed by a native
443 // GpuMemoryBuffer.
444 scoped_refptr<gl::GLImage> image_;
445
428 DISALLOW_COPY_AND_ASSIGN(BackTexture); 446 DISALLOW_COPY_AND_ASSIGN(BackTexture);
429 }; 447 };
430 448
431 // Encapsulates an OpenGL render buffer of any format. 449 // Encapsulates an OpenGL render buffer of any format.
432 class BackRenderbuffer { 450 class BackRenderbuffer {
433 public: 451 public:
434 explicit BackRenderbuffer( 452 explicit BackRenderbuffer(GLES2DecoderImpl* decoder);
435 RenderbufferManager* renderbuffer_manager,
436 MemoryTracker* memory_tracker,
437 ContextState* state);
438 ~BackRenderbuffer(); 453 ~BackRenderbuffer();
439 454
440 // Create a new render buffer. 455 // Create a new render buffer.
441 void Create(); 456 void Create();
442 457
443 // Set the initial size and format of a render buffer or resize it. 458 // Set the initial size and format of a render buffer or resize it.
444 bool AllocateStorage(const FeatureInfo* feature_info, 459 bool AllocateStorage(const FeatureInfo* feature_info,
445 const gfx::Size& size, 460 const gfx::Size& size,
446 GLenum format, 461 GLenum format,
447 GLsizei samples); 462 GLsizei samples);
448 463
449 // Destroy the render buffer. This must be explicitly called before destroying 464 // Destroy the render buffer. This must be explicitly called before destroying
450 // this object. 465 // this object.
451 void Destroy(); 466 void Destroy();
452 467
453 // Invalidate the render buffer. This can be used when a context is lost and 468 // Invalidate the render buffer. This can be used when a context is lost and
454 // it is not possible to make it current in order to free the resource. 469 // it is not possible to make it current in order to free the resource.
455 void Invalidate(); 470 void Invalidate();
456 471
457 GLuint id() const { 472 GLuint id() const {
458 return id_; 473 return id_;
459 } 474 }
460 475
461 private: 476 private:
462 RenderbufferManager* renderbuffer_manager_; 477 GLES2DecoderImpl* decoder_;
463 MemoryTypeTracker memory_tracker_; 478 MemoryTypeTracker memory_tracker_;
464 ContextState* state_;
465 size_t bytes_allocated_; 479 size_t bytes_allocated_;
466 GLuint id_; 480 GLuint id_;
467 DISALLOW_COPY_AND_ASSIGN(BackRenderbuffer); 481 DISALLOW_COPY_AND_ASSIGN(BackRenderbuffer);
468 }; 482 };
469 483
470 // Encapsulates an OpenGL frame buffer. 484 // Encapsulates an OpenGL frame buffer.
471 class BackFramebuffer { 485 class BackFramebuffer {
472 public: 486 public:
473 explicit BackFramebuffer(GLES2DecoderImpl* decoder); 487 explicit BackFramebuffer(GLES2DecoderImpl* decoder);
474 ~BackFramebuffer(); 488 ~BackFramebuffer();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 678
665 // Restores the current state to the user's settings. 679 // Restores the current state to the user's settings.
666 void RestoreCurrentFramebufferBindings(); 680 void RestoreCurrentFramebufferBindings();
667 681
668 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer. 682 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer.
669 void ApplyDirtyState(); 683 void ApplyDirtyState();
670 684
671 // These check the state of the currently bound framebuffer or the 685 // These check the state of the currently bound framebuffer or the
672 // backbuffer if no framebuffer is bound. 686 // backbuffer if no framebuffer is bound.
673 // Check with all attached and enabled color attachments. 687 // Check with all attached and enabled color attachments.
674 bool BoundFramebufferHasColorAttachmentWithAlpha(); 688 bool BoundFramebufferAllowsChangesToAlphaChannel();
675 bool BoundFramebufferHasDepthAttachment(); 689 bool BoundFramebufferHasDepthAttachment();
676 bool BoundFramebufferHasStencilAttachment(); 690 bool BoundFramebufferHasStencilAttachment();
677 691
678 error::ContextLostReason GetContextLostReason() override; 692 error::ContextLostReason GetContextLostReason() override;
679 693
680 // Overriden from ErrorStateClient. 694 // Overriden from ErrorStateClient.
681 void OnContextLostError() override; 695 void OnContextLostError() override;
682 void OnOutOfMemoryError() override; 696 void OnOutOfMemoryError() override;
683 697
684 // Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound. 698 // Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound.
(...skipping 19 matching lines...) Expand all
704 GLbitfield mask, 718 GLbitfield mask,
705 GLenum filter); 719 GLenum filter);
706 720
707 PathManager* path_manager() { return group_->path_manager(); } 721 PathManager* path_manager() { return group_->path_manager(); }
708 722
709 private: 723 private:
710 friend class ScopedFrameBufferBinder; 724 friend class ScopedFrameBufferBinder;
711 friend class ScopedFrameBufferReadPixelHelper; 725 friend class ScopedFrameBufferReadPixelHelper;
712 friend class ScopedResolvedFrameBufferBinder; 726 friend class ScopedResolvedFrameBufferBinder;
713 friend class BackFramebuffer; 727 friend class BackFramebuffer;
728 friend class BackRenderbuffer;
714 friend class BackTexture; 729 friend class BackTexture;
715 730
716 enum FramebufferOperation { 731 enum FramebufferOperation {
717 kFramebufferDiscard, 732 kFramebufferDiscard,
718 kFramebufferInvalidate, 733 kFramebufferInvalidate,
719 kFramebufferInvalidateSub 734 kFramebufferInvalidateSub
720 }; 735 };
721 736
722 enum BindIndexedBufferFunctionType { 737 enum BindIndexedBufferFunctionType {
723 kBindBufferBase, 738 kBindBufferBase,
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 error::Error WillAccessBoundFramebufferForRead() { 1956 error::Error WillAccessBoundFramebufferForRead() {
1942 if (ShouldDeferReads()) 1957 if (ShouldDeferReads())
1943 return error::kDeferCommandUntilLater; 1958 return error::kDeferCommandUntilLater;
1944 if (!offscreen_target_frame_buffer_.get() && 1959 if (!offscreen_target_frame_buffer_.get() &&
1945 !framebuffer_state_.bound_read_framebuffer.get() && 1960 !framebuffer_state_.bound_read_framebuffer.get() &&
1946 !surface_->SetBackbufferAllocation(true)) 1961 !surface_->SetBackbufferAllocation(true))
1947 return error::kLostContext; 1962 return error::kLostContext;
1948 return error::kNoError; 1963 return error::kNoError;
1949 } 1964 }
1950 1965
1951 bool BackBufferHasAlpha() const { 1966 // Whether the back buffer exposed to the client has an alpha channel. Note
1967 // that this is potentially different from whether the implementation of the
1968 // back buffer has an alpha channel.
1969 bool ClientExposedBackBufferHasAlpha() const {
1952 if (back_buffer_draw_buffer_ == GL_NONE) 1970 if (back_buffer_draw_buffer_ == GL_NONE)
1953 return false; 1971 return false;
1954 if (offscreen_target_frame_buffer_.get()) { 1972 if (offscreen_target_frame_buffer_.get()) {
1955 return (offscreen_target_color_format_ == GL_RGBA || 1973 return offscreen_buffer_should_have_alpha_;
1956 offscreen_target_color_format_ == GL_RGBA8);
1957 } 1974 }
1958 return (back_buffer_color_format_ == GL_RGBA || 1975 return (back_buffer_color_format_ == GL_RGBA ||
1959 back_buffer_color_format_ == GL_RGBA8); 1976 back_buffer_color_format_ == GL_RGBA8);
1960 } 1977 }
1961 1978
1979 // If the back buffer has a non-emulated alpha channel, the clear color should
1980 // be 0. Otherwise, the clear color should be 1.
1981 GLfloat BackBufferAlphaClearColor() const {
1982 return offscreen_buffer_should_have_alpha_ ? 0.f : 1.f;
1983 }
1984
1962 // Set remaining commands to process to 0 to force DoCommands to return 1985 // Set remaining commands to process to 0 to force DoCommands to return
1963 // and allow context preemption and GPU watchdog checks in CommandExecutor(). 1986 // and allow context preemption and GPU watchdog checks in CommandExecutor().
1964 void ExitCommandProcessingEarly() { commands_to_process_ = 0; } 1987 void ExitCommandProcessingEarly() { commands_to_process_ = 0; }
1965 1988
1966 void ProcessPendingReadPixels(bool did_finish); 1989 void ProcessPendingReadPixels(bool did_finish);
1967 void FinishReadPixels(const cmds::ReadPixels& c, GLuint buffer); 1990 void FinishReadPixels(const cmds::ReadPixels& c, GLuint buffer);
1968 1991
1969 // Checks to see if the inserted fence has completed. 1992 // Checks to see if the inserted fence has completed.
1970 void ProcessDescheduleUntilFinished(); 1993 void ProcessDescheduleUntilFinished();
1971 1994
1972 void DoBindFragmentInputLocationCHROMIUM(GLuint program_id, 1995 void DoBindFragmentInputLocationCHROMIUM(GLuint program_id,
1973 GLint location, 1996 GLint location,
1974 const std::string& name); 1997 const std::string& name);
1975 1998
1976 // If |texture_manager_version_| doesn't match the current version, then this 1999 // If |texture_manager_version_| doesn't match the current version, then this
1977 // will rebind all external textures to match their current service_id. 2000 // will rebind all external textures to match their current service_id.
1978 void RestoreAllExternalTextureBindingsIfNeeded() override; 2001 void RestoreAllExternalTextureBindingsIfNeeded() override;
1979 2002
1980 const SamplerState& GetSamplerStateForTextureUnit(GLenum target, GLuint unit); 2003 const SamplerState& GetSamplerStateForTextureUnit(GLenum target, GLuint unit);
1981 2004
1982 // copyTexImage2D doesn't work on OSX under very specific conditions. 2005 // copyTexImage2D doesn't work on OSX under very specific conditions.
1983 // Returns whether those conditions have been met. If this method returns 2006 // Returns whether those conditions have been met. If this method returns
1984 // true, |source_texture_service_id| and |source_texture_target| are also 2007 // true, |source_texture_service_id| and |source_texture_target| are also
1985 // populated, since they are needed to implement the workaround. 2008 // populated, since they are needed to implement the workaround.
1986 bool NeedsCopyTextureImageWorkaround(GLenum internal_format, 2009 bool NeedsCopyTextureImageWorkaround(GLenum internal_format,
1987 int32_t channels_exist, 2010 int32_t channels_exist,
1988 GLuint* source_texture_service_id, 2011 GLuint* source_texture_service_id,
1989 GLenum* source_texture_target); 2012 GLenum* source_texture_target);
1990 2013
2014 // Whether a texture backed by a Chromium Image needs to emulate GL_RGB format
2015 // using GL_RGBA and glColorMask.
2016 bool ChromiumImageNeedsRGBEmulation();
2017
1991 bool InitializeCopyTexImageBlitter(const char* function_name); 2018 bool InitializeCopyTexImageBlitter(const char* function_name);
1992 bool InitializeCopyTextureCHROMIUM(const char* function_name); 2019 bool InitializeCopyTextureCHROMIUM(const char* function_name);
1993 // Generate a member function prototype for each command in an automated and 2020 // Generate a member function prototype for each command in an automated and
1994 // typesafe way. 2021 // typesafe way.
1995 #define GLES2_CMD_OP(name) \ 2022 #define GLES2_CMD_OP(name) \
1996 Error Handle##name(uint32_t immediate_data_size, const void* data); 2023 Error Handle##name(uint32_t immediate_data_size, const void* data);
1997 2024
1998 GLES2_COMMAND_LIST(GLES2_CMD_OP) 2025 GLES2_COMMAND_LIST(GLES2_CMD_OP)
1999 2026
2000 #undef GLES2_CMD_OP 2027 #undef GLES2_CMD_OP
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 2067
2041 // The offscreen frame buffer that the client renders to. With EGL, the 2068 // The offscreen frame buffer that the client renders to. With EGL, the
2042 // depth and stencil buffers are separate. With regular GL there is a single 2069 // depth and stencil buffers are separate. With regular GL there is a single
2043 // packed depth stencil buffer in offscreen_target_depth_render_buffer_. 2070 // packed depth stencil buffer in offscreen_target_depth_render_buffer_.
2044 // offscreen_target_stencil_render_buffer_ is unused. 2071 // offscreen_target_stencil_render_buffer_ is unused.
2045 std::unique_ptr<BackFramebuffer> offscreen_target_frame_buffer_; 2072 std::unique_ptr<BackFramebuffer> offscreen_target_frame_buffer_;
2046 std::unique_ptr<BackTexture> offscreen_target_color_texture_; 2073 std::unique_ptr<BackTexture> offscreen_target_color_texture_;
2047 std::unique_ptr<BackRenderbuffer> offscreen_target_color_render_buffer_; 2074 std::unique_ptr<BackRenderbuffer> offscreen_target_color_render_buffer_;
2048 std::unique_ptr<BackRenderbuffer> offscreen_target_depth_render_buffer_; 2075 std::unique_ptr<BackRenderbuffer> offscreen_target_depth_render_buffer_;
2049 std::unique_ptr<BackRenderbuffer> offscreen_target_stencil_render_buffer_; 2076 std::unique_ptr<BackRenderbuffer> offscreen_target_stencil_render_buffer_;
2077
2078 // The format of the texture or renderbuffer backing the offscreen
2079 // framebuffer. Also the format of the texture backing the saved offscreen
2080 // framebuffer.
2050 GLenum offscreen_target_color_format_; 2081 GLenum offscreen_target_color_format_;
2082
2051 GLenum offscreen_target_depth_format_; 2083 GLenum offscreen_target_depth_format_;
2052 GLenum offscreen_target_stencil_format_; 2084 GLenum offscreen_target_stencil_format_;
2053 GLsizei offscreen_target_samples_; 2085 GLsizei offscreen_target_samples_;
2054 GLboolean offscreen_target_buffer_preserved_; 2086 GLboolean offscreen_target_buffer_preserved_;
2055 2087
2056 // The saved copy of the backbuffer after a call to SwapBuffers. 2088 // The saved copy of the backbuffer after a call to SwapBuffers.
2057 std::unique_ptr<BackTexture> offscreen_saved_color_texture_; 2089 std::unique_ptr<BackTexture> offscreen_saved_color_texture_;
2058 2090
2059 // For simplicity, |offscreen_saved_color_texture_| is always bound to 2091 // For simplicity, |offscreen_saved_color_texture_| is always bound to
2060 // |offscreen_saved_frame_buffer_|. 2092 // |offscreen_saved_frame_buffer_|.
(...skipping 23 matching lines...) Expand all
2084 void ReleaseAllBackTextures(bool have_context); 2116 void ReleaseAllBackTextures(bool have_context);
2085 2117
2086 size_t GetSavedBackTextureCountForTest() override; 2118 size_t GetSavedBackTextureCountForTest() override;
2087 size_t GetCreatedBackTextureCountForTest() override; 2119 size_t GetCreatedBackTextureCountForTest() override;
2088 2120
2089 // The copy that is used as the destination for multi-sample resolves. 2121 // The copy that is used as the destination for multi-sample resolves.
2090 std::unique_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; 2122 std::unique_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_;
2091 std::unique_ptr<BackTexture> offscreen_resolved_color_texture_; 2123 std::unique_ptr<BackTexture> offscreen_resolved_color_texture_;
2092 GLenum offscreen_saved_color_format_; 2124 GLenum offscreen_saved_color_format_;
2093 2125
2126 // Whether the client requested an offscreen buffer with an alpha channel.
2127 bool offscreen_buffer_should_have_alpha_;
2128
2094 std::unique_ptr<QueryManager> query_manager_; 2129 std::unique_ptr<QueryManager> query_manager_;
2095 2130
2096 std::unique_ptr<VertexArrayManager> vertex_array_manager_; 2131 std::unique_ptr<VertexArrayManager> vertex_array_manager_;
2097 2132
2098 std::unique_ptr<ImageManager> image_manager_; 2133 std::unique_ptr<ImageManager> image_manager_;
2099 2134
2100 FenceSyncReleaseCallback fence_sync_release_callback_; 2135 FenceSyncReleaseCallback fence_sync_release_callback_;
2101 WaitFenceSyncCallback wait_fence_sync_callback_; 2136 WaitFenceSyncCallback wait_fence_sync_callback_;
2102 NoParamCallback deschedule_until_finished_callback_; 2137 NoParamCallback deschedule_until_finished_callback_;
2103 NoParamCallback reschedule_after_finished_callback_; 2138 NoParamCallback reschedule_after_finished_callback_;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 bool derivatives_explicitly_enabled_; 2193 bool derivatives_explicitly_enabled_;
2159 bool frag_depth_explicitly_enabled_; 2194 bool frag_depth_explicitly_enabled_;
2160 bool draw_buffers_explicitly_enabled_; 2195 bool draw_buffers_explicitly_enabled_;
2161 bool shader_texture_lod_explicitly_enabled_; 2196 bool shader_texture_lod_explicitly_enabled_;
2162 2197
2163 bool compile_shader_always_succeeds_; 2198 bool compile_shader_always_succeeds_;
2164 2199
2165 // An optional behaviour to lose the context and group when OOM. 2200 // An optional behaviour to lose the context and group when OOM.
2166 bool lose_context_when_out_of_memory_; 2201 bool lose_context_when_out_of_memory_;
2167 2202
2203 // Forces the backbuffer to use native GMBs rather than a TEXTURE_2D texture.
2204 bool should_use_native_gmb_for_backbuffer_;
2205
2168 // Log extra info. 2206 // Log extra info.
2169 bool service_logging_; 2207 bool service_logging_;
2170 2208
2171 std::unique_ptr<ApplyFramebufferAttachmentCMAAINTELResourceManager> 2209 std::unique_ptr<ApplyFramebufferAttachmentCMAAINTELResourceManager>
2172 apply_framebuffer_attachment_cmaa_intel_; 2210 apply_framebuffer_attachment_cmaa_intel_;
2173 std::unique_ptr<CopyTexImageResourceManager> copy_tex_image_blit_; 2211 std::unique_ptr<CopyTexImageResourceManager> copy_tex_image_blit_;
2174 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; 2212 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_;
2175 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; 2213 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_;
2176 2214
2177 // Cached values of the currently assigned viewport dimensions. 2215 // Cached values of the currently assigned viewport dimensions.
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 GLES2DecoderImpl* decoder, bool enforce_internal_framebuffer, bool internal) 2361 GLES2DecoderImpl* decoder, bool enforce_internal_framebuffer, bool internal)
2324 : decoder_(decoder) { 2362 : decoder_(decoder) {
2325 resolve_and_bind_ = ( 2363 resolve_and_bind_ = (
2326 decoder_->offscreen_target_frame_buffer_.get() && 2364 decoder_->offscreen_target_frame_buffer_.get() &&
2327 decoder_->IsOffscreenBufferMultisampled() && 2365 decoder_->IsOffscreenBufferMultisampled() &&
2328 (!decoder_->framebuffer_state_.bound_read_framebuffer.get() || 2366 (!decoder_->framebuffer_state_.bound_read_framebuffer.get() ||
2329 enforce_internal_framebuffer)); 2367 enforce_internal_framebuffer));
2330 if (!resolve_and_bind_) 2368 if (!resolve_and_bind_)
2331 return; 2369 return;
2332 2370
2371 // TODO(erikchen): On old AMD GPUs on macOS, glColorMask doesn't work
2372 // correctly for multisampled renderbuffers and the alpha channel can be
2373 // overwritten. Add a workaround to clear the alpha channel before resolving.
2374 // https://crbug.com/602484.
2333 ScopedGLErrorSuppressor suppressor( 2375 ScopedGLErrorSuppressor suppressor(
2334 "ScopedResolvedFrameBufferBinder::ctor", decoder_->GetErrorState()); 2376 "ScopedResolvedFrameBufferBinder::ctor", decoder_->GetErrorState());
2335 glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 2377 glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT,
2336 decoder_->offscreen_target_frame_buffer_->id()); 2378 decoder_->offscreen_target_frame_buffer_->id());
2337 GLuint targetid; 2379 GLuint targetid;
2338 if (internal) { 2380 if (internal) {
2339 if (!decoder_->offscreen_resolved_frame_buffer_.get()) { 2381 if (!decoder_->offscreen_resolved_frame_buffer_.get()) {
2340 decoder_->offscreen_resolved_frame_buffer_.reset( 2382 decoder_->offscreen_resolved_frame_buffer_.reset(
2341 new BackFramebuffer(decoder_)); 2383 new BackFramebuffer(decoder_));
2342 decoder_->offscreen_resolved_frame_buffer_->Create(); 2384 decoder_->offscreen_resolved_frame_buffer_->Create();
(...skipping 15 matching lines...) Expand all
2358 } 2400 }
2359 } 2401 }
2360 targetid = decoder_->offscreen_resolved_frame_buffer_->id(); 2402 targetid = decoder_->offscreen_resolved_frame_buffer_->id();
2361 } else { 2403 } else {
2362 targetid = decoder_->offscreen_saved_frame_buffer_->id(); 2404 targetid = decoder_->offscreen_saved_frame_buffer_->id();
2363 } 2405 }
2364 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, targetid); 2406 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, targetid);
2365 const int width = decoder_->offscreen_size_.width(); 2407 const int width = decoder_->offscreen_size_.width();
2366 const int height = decoder_->offscreen_size_.height(); 2408 const int height = decoder_->offscreen_size_.height();
2367 decoder->state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); 2409 decoder->state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
2410 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, targetid);
piman 2016/06/27 19:37:36 nit: this was already done on l.2406
erikchen 2016/06/27 22:16:03 Removed.
2368 decoder->BlitFramebufferHelper(0, 2411 decoder->BlitFramebufferHelper(0,
2369 0, 2412 0,
2370 width, 2413 width,
2371 height, 2414 height,
2372 0, 2415 0,
2373 0, 2416 0,
2374 width, 2417 width,
2375 height, 2418 height,
2376 GL_COLOR_BUFFER_BIT, 2419 GL_COLOR_BUFFER_BIT,
2377 GL_NEAREST); 2420 GL_NEAREST);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 BackTexture::BackTexture(GLES2DecoderImpl* decoder) 2471 BackTexture::BackTexture(GLES2DecoderImpl* decoder)
2429 : memory_tracker_(decoder->memory_tracker()), 2472 : memory_tracker_(decoder->memory_tracker()),
2430 bytes_allocated_(0), 2473 bytes_allocated_(0),
2431 decoder_(decoder) {} 2474 decoder_(decoder) {}
2432 2475
2433 BackTexture::~BackTexture() { 2476 BackTexture::~BackTexture() {
2434 // This does not destroy the render texture because that would require that 2477 // This does not destroy the render texture because that would require that
2435 // the associated GL context was current. Just check that it was explicitly 2478 // the associated GL context was current. Just check that it was explicitly
2436 // destroyed. 2479 // destroyed.
2437 DCHECK_EQ(id(), 0u); 2480 DCHECK_EQ(id(), 0u);
2481 DCHECK(!image_.get());
2438 } 2482 }
2439 2483
2440 void BackTexture::Create() { 2484 void BackTexture::Create() {
2441 DCHECK_EQ(id(), 0u); 2485 DCHECK_EQ(id(), 0u);
2442 ScopedGLErrorSuppressor suppressor("BackTexture::Create", 2486 ScopedGLErrorSuppressor suppressor("BackTexture::Create",
2443 decoder_->state_.GetErrorState()); 2487 decoder_->state_.GetErrorState());
2444 GLuint id; 2488 GLuint id;
2445 glGenTextures(1, &id); 2489 glGenTextures(1, &id);
2446 2490
2447 GLenum target = GL_TEXTURE_2D; 2491 GLenum target = Target();
2448 ScopedTextureBinder binder(&decoder_->state_, id, target); 2492 ScopedTextureBinder binder(&decoder_->state_, id, target);
2449 2493
2450 // No client id is necessary because this texture will never be directly 2494 // No client id is necessary because this texture will never be directly
2451 // accessed by a client, only indirectly via a mailbox. 2495 // accessed by a client, only indirectly via a mailbox.
2452 texture_ref_ = TextureRef::Create(decoder_->texture_manager(), 0, id); 2496 texture_ref_ = TextureRef::Create(decoder_->texture_manager(), 0, id);
2453 decoder_->texture_manager()->SetTarget(texture_ref_.get(), target); 2497 decoder_->texture_manager()->SetTarget(texture_ref_.get(), target);
2454 decoder_->texture_manager()->SetParameteri( 2498 decoder_->texture_manager()->SetParameteri(
2455 "BackTexture::Create", 2499 "BackTexture::Create",
2456 decoder_->GetErrorState(), 2500 decoder_->GetErrorState(),
2457 texture_ref_.get(), 2501 texture_ref_.get(),
(...skipping 17 matching lines...) Expand all
2475 texture_ref_.get(), 2519 texture_ref_.get(),
2476 GL_TEXTURE_WRAP_T, 2520 GL_TEXTURE_WRAP_T,
2477 GL_CLAMP_TO_EDGE); 2521 GL_CLAMP_TO_EDGE);
2478 } 2522 }
2479 2523
2480 bool BackTexture::AllocateStorage( 2524 bool BackTexture::AllocateStorage(
2481 const gfx::Size& size, GLenum format, bool zero) { 2525 const gfx::Size& size, GLenum format, bool zero) {
2482 DCHECK_NE(id(), 0u); 2526 DCHECK_NE(id(), 0u);
2483 ScopedGLErrorSuppressor suppressor("BackTexture::AllocateStorage", 2527 ScopedGLErrorSuppressor suppressor("BackTexture::AllocateStorage",
2484 decoder_->state_.GetErrorState()); 2528 decoder_->state_.GetErrorState());
2485 ScopedTextureBinder binder(&decoder_->state_, id(), GL_TEXTURE_2D); 2529 ScopedTextureBinder binder(&decoder_->state_, id(), Target());
2486 uint32_t image_size = 0; 2530 uint32_t image_size = 0;
2487 GLES2Util::ComputeImageDataSizes( 2531 GLES2Util::ComputeImageDataSizes(
2488 size.width(), size.height(), 1, format, GL_UNSIGNED_BYTE, 8, &image_size, 2532 size.width(), size.height(), 1, format, GL_UNSIGNED_BYTE, 8, &image_size,
2489 NULL, NULL); 2533 NULL, NULL);
2490 2534
2491 if (!memory_tracker_.EnsureGPUMemoryAvailable(image_size)) { 2535 if (!memory_tracker_.EnsureGPUMemoryAvailable(image_size)) {
2492 return false; 2536 return false;
2493 } 2537 }
2494 2538
2495 std::unique_ptr<char[]> zero_data; 2539 size_ = size;
2496 if (zero) { 2540 if (decoder_->should_use_native_gmb_for_backbuffer_) {
2497 zero_data.reset(new char[image_size]); 2541 DestroyNativeGpuMemoryBuffer(true);
2498 memset(zero_data.get(), 0, image_size); 2542 AllocateNativeGpuMemoryBuffer(size, format, zero);
2543 } else {
2544 std::unique_ptr<char[]> zero_data;
2545 if (zero) {
2546 zero_data.reset(new char[image_size]);
2547 memset(zero_data.get(), 0, image_size);
2548 }
2549
2550 glTexImage2D(Target(),
2551 0, // mip level
2552 format, size.width(), size.height(),
2553 0, // border
2554 format, GL_UNSIGNED_BYTE, zero_data.get());
2555 decoder_->texture_manager()->SetLevelInfo(
2556 texture_ref_.get(), Target(),
2557 0, // level
2558 GL_RGBA, size.width(), size.height(),
2559 1, // depth
2560 0, // border
2561 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(size));
2499 } 2562 }
2500 2563
2501 glTexImage2D(GL_TEXTURE_2D,
2502 0, // mip level
2503 format,
2504 size.width(),
2505 size.height(),
2506 0, // border
2507 format,
2508 GL_UNSIGNED_BYTE,
2509 zero_data.get());
2510
2511 size_ = size;
2512 decoder_->texture_manager()->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D,
2513 0, // level
2514 GL_RGBA, size_.width(), size_.height(),
2515 1, // depth
2516 0, // border
2517 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(size_));
2518
2519 bool success = glGetError() == GL_NO_ERROR; 2564 bool success = glGetError() == GL_NO_ERROR;
2520 if (success) { 2565 if (success) {
2521 memory_tracker_.TrackMemFree(bytes_allocated_); 2566 memory_tracker_.TrackMemFree(bytes_allocated_);
2522 bytes_allocated_ = image_size; 2567 bytes_allocated_ = image_size;
2523 memory_tracker_.TrackMemAlloc(bytes_allocated_); 2568 memory_tracker_.TrackMemAlloc(bytes_allocated_);
2524 } 2569 }
2525 return success; 2570 return success;
2526 } 2571 }
2527 2572
2528 void BackTexture::Copy(const gfx::Size& size, GLenum format) { 2573 void BackTexture::Copy(const gfx::Size& size, GLenum format) {
2529 DCHECK_NE(id(), 0u); 2574 DCHECK_NE(id(), 0u);
2530 ScopedGLErrorSuppressor suppressor("BackTexture::Copy", 2575 ScopedGLErrorSuppressor suppressor("BackTexture::Copy",
2531 decoder_->state_.GetErrorState()); 2576 decoder_->state_.GetErrorState());
2532 ScopedTextureBinder binder(&decoder_->state_, id(), GL_TEXTURE_2D); 2577 ScopedTextureBinder binder(&decoder_->state_, id(), Target());
2533 glCopyTexImage2D(GL_TEXTURE_2D, 2578 glCopyTexImage2D(Target(),
2534 0, // level 2579 0, // level
2535 format, 2580 format, 0, 0, size.width(), size.height(),
2536 0, 0,
2537 size.width(),
2538 size.height(),
2539 0); // border 2581 0); // border
2540 } 2582 }
2541 2583
2542 void BackTexture::Destroy() { 2584 void BackTexture::Destroy() {
2585 if (image_) {
2586 DCHECK(texture_ref_);
2587 ScopedTextureBinder binder(&decoder_->state_, id(), Target());
2588 DestroyNativeGpuMemoryBuffer(true);
2589 }
2590
2543 if (texture_ref_) { 2591 if (texture_ref_) {
2544 ScopedGLErrorSuppressor suppressor("BackTexture::Destroy", 2592 ScopedGLErrorSuppressor suppressor("BackTexture::Destroy",
2545 decoder_->state_.GetErrorState()); 2593 decoder_->state_.GetErrorState());
2546 texture_ref_ = nullptr; 2594 texture_ref_ = nullptr;
2547 } 2595 }
2548 memory_tracker_.TrackMemFree(bytes_allocated_); 2596 memory_tracker_.TrackMemFree(bytes_allocated_);
2549 bytes_allocated_ = 0; 2597 bytes_allocated_ = 0;
2550 } 2598 }
2551 2599
2552 void BackTexture::Invalidate() { 2600 void BackTexture::Invalidate() {
2601 if (image_) {
2602 DestroyNativeGpuMemoryBuffer(false);
2603 image_ = nullptr;
2604 }
2553 if (texture_ref_) { 2605 if (texture_ref_) {
2554 texture_ref_->ForceContextLost(); 2606 texture_ref_->ForceContextLost();
2555 texture_ref_ = nullptr; 2607 texture_ref_ = nullptr;
2556 } 2608 }
2557 } 2609 }
2558 2610
2559 BackRenderbuffer::BackRenderbuffer( 2611 GLenum BackTexture::Target() {
2560 RenderbufferManager* renderbuffer_manager, 2612 // TODO(erikchen): Make this method more robust by not assuming that a native
2561 MemoryTracker* memory_tracker, 2613 // GMB has target GL_TEXTURE_RECTANGLE_ARB.
2562 ContextState* state) 2614 return decoder_->should_use_native_gmb_for_backbuffer_
2563 : renderbuffer_manager_(renderbuffer_manager), 2615 ? GL_TEXTURE_RECTANGLE_ARB
piman 2016/06/27 19:37:36 nit: could the target be given by the ImageFactory
erikchen 2016/06/27 22:16:03 Yes, Done
2564 memory_tracker_(memory_tracker), 2616 : GL_TEXTURE_2D;
2565 state_(state), 2617 }
2618
2619 void BackTexture::AllocateNativeGpuMemoryBuffer(const gfx::Size& size,
2620 GLenum format,
2621 bool zero) {
2622 gfx::BufferFormat buffer_format = gfx::BufferFormat::RGBA_8888;
2623 scoped_refptr<gl::GLImage> image =
2624 decoder_->GetContextGroup()->image_factory()->CreateAnonymousImage(
piman 2016/06/27 19:37:36 image_factory could be null.
erikchen 2016/06/27 22:16:04 This gets DCHECKED in the constructor of BackTextu
2625 size, buffer_format, format);
2626 if (!image->BindTexImage(Target()))
piman 2016/06/27 19:37:36 image could be null if the ImageFactory doesn't su
erikchen 2016/06/27 22:16:04 Added a conditional.
2627 return;
piman 2016/06/27 19:37:36 Can we forward the failure, so that we can e.g. lo
erikchen 2016/06/27 22:16:03 Done.
2628
2629 image_ = image;
2630 decoder_->texture_manager()->SetLevelInfo(
2631 texture_ref_.get(), Target(), 0, image_->GetInternalFormat(),
2632 size.width(), size.height(), 1, 0, image_->GetInternalFormat(),
2633 GL_UNSIGNED_BYTE, gfx::Rect(size));
2634 decoder_->texture_manager()->SetLevelImage(texture_ref_.get(), Target(), 0,
2635 image_.get(), Texture::BOUND);
2636
2637 // Ignore the zero flag if the alpha channel needs to be cleared for RGB
2638 // emulation.
2639 bool needs_clear_for_rgb_emulation =
2640 !decoder_->offscreen_buffer_should_have_alpha_ &&
2641 decoder_->ChromiumImageNeedsRGBEmulation();
2642 if (zero || needs_clear_for_rgb_emulation) {
2643 GLuint fbo;
2644 glGenFramebuffersEXT(1, &fbo);
2645 {
2646 ScopedFrameBufferBinder binder(decoder_, fbo);
2647 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, Target(),
2648 id(), 0);
2649 glClearColor(0, 0, 0, decoder_->BackBufferAlphaClearColor());
2650 decoder_->state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
2651 decoder_->state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
2652 glClear(GL_COLOR_BUFFER_BIT);
2653 decoder_->RestoreClearState();
2654 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, Target(),
2655 0, 0);
piman 2016/06/27 19:37:36 nit: is this necessary? You're about to destroy th
erikchen 2016/06/27 22:16:04 No, removed.
2656 }
2657 glDeleteFramebuffersEXT(1, &fbo);
2658 }
2659 }
2660
2661 void BackTexture::DestroyNativeGpuMemoryBuffer(bool have_context) {
2662 if (image_) {
2663 ScopedGLErrorSuppressor suppressor(
2664 "BackTexture::DestroyNativeGpuMemoryBuffer",
2665 decoder_->state_.GetErrorState());
2666
2667 image_->ReleaseTexImage(Target());
2668 image_->Destroy(have_context);
2669
2670 decoder_->texture_manager()->SetLevelImage(texture_ref_.get(), Target(), 0,
2671 nullptr, Texture::UNBOUND);
2672 image_ = nullptr;
2673 }
2674 }
2675
2676 BackRenderbuffer::BackRenderbuffer(GLES2DecoderImpl* decoder)
2677 : decoder_(decoder),
2678 memory_tracker_(decoder->memory_tracker()),
2566 bytes_allocated_(0), 2679 bytes_allocated_(0),
2567 id_(0) { 2680 id_(0) {}
2568 }
2569 2681
2570 BackRenderbuffer::~BackRenderbuffer() { 2682 BackRenderbuffer::~BackRenderbuffer() {
2571 // This does not destroy the render buffer because that would require that 2683 // This does not destroy the render buffer because that would require that
2572 // the associated GL context was current. Just check that it was explicitly 2684 // the associated GL context was current. Just check that it was explicitly
2573 // destroyed. 2685 // destroyed.
2574 DCHECK_EQ(id_, 0u); 2686 DCHECK_EQ(id_, 0u);
2575 } 2687 }
2576 2688
2577 void BackRenderbuffer::Create() { 2689 void BackRenderbuffer::Create() {
2578 ScopedGLErrorSuppressor suppressor("BackRenderbuffer::Create", 2690 ScopedGLErrorSuppressor suppressor("BackRenderbuffer::Create",
2579 state_->GetErrorState()); 2691 decoder_->state_.GetErrorState());
2580 Destroy(); 2692 Destroy();
2581 glGenRenderbuffersEXT(1, &id_); 2693 glGenRenderbuffersEXT(1, &id_);
2582 } 2694 }
2583 2695
2584 bool BackRenderbuffer::AllocateStorage(const FeatureInfo* feature_info, 2696 bool BackRenderbuffer::AllocateStorage(const FeatureInfo* feature_info,
2585 const gfx::Size& size, 2697 const gfx::Size& size,
2586 GLenum format, 2698 GLenum format,
2587 GLsizei samples) { 2699 GLsizei samples) {
2588 ScopedGLErrorSuppressor suppressor( 2700 ScopedGLErrorSuppressor suppressor("BackRenderbuffer::AllocateStorage",
2589 "BackRenderbuffer::AllocateStorage", state_->GetErrorState()); 2701 decoder_->state_.GetErrorState());
2590 ScopedRenderBufferBinder binder(state_, id_); 2702 ScopedRenderBufferBinder binder(&decoder_->state_, id_);
2591 2703
2592 uint32_t estimated_size = 0; 2704 uint32_t estimated_size = 0;
2593 if (!renderbuffer_manager_->ComputeEstimatedRenderbufferSize( 2705 if (!decoder_->renderbuffer_manager()->ComputeEstimatedRenderbufferSize(
2594 size.width(), size.height(), samples, format, &estimated_size)) { 2706 size.width(), size.height(), samples, format, &estimated_size)) {
2595 return false; 2707 return false;
2596 } 2708 }
2597 2709
2598 if (!memory_tracker_.EnsureGPUMemoryAvailable(estimated_size)) { 2710 if (!memory_tracker_.EnsureGPUMemoryAvailable(estimated_size)) {
2599 return false; 2711 return false;
2600 } 2712 }
2601 2713
2602 if (samples <= 1) { 2714 if (samples <= 1) {
2603 glRenderbufferStorageEXT(GL_RENDERBUFFER, 2715 glRenderbufferStorageEXT(GL_RENDERBUFFER,
2604 format, 2716 format,
2605 size.width(), 2717 size.width(),
2606 size.height()); 2718 size.height());
2607 } else { 2719 } else {
2608 GLES2DecoderImpl::RenderbufferStorageMultisampleHelper(feature_info, 2720 GLES2DecoderImpl::RenderbufferStorageMultisampleHelper(feature_info,
2609 GL_RENDERBUFFER, 2721 GL_RENDERBUFFER,
2610 samples, 2722 samples,
2611 format, 2723 format,
2612 size.width(), 2724 size.width(),
2613 size.height()); 2725 size.height());
2614 } 2726 }
2727
2728 bool alpha_channel_needs_clear =
2729 (format == GL_RGBA || format == GL_RGBA8) &&
2730 !decoder_->offscreen_buffer_should_have_alpha_;
2731 if (alpha_channel_needs_clear) {
2732 GLuint fbo;
2733 glGenFramebuffersEXT(1, &fbo);
2734 {
2735 ScopedFrameBufferBinder binder(decoder_, fbo);
2736 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
2737 GL_RENDERBUFFER, id_);
2738 glClearColor(0, 0, 0, decoder_->BackBufferAlphaClearColor());
2739 decoder_->state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
2740 decoder_->state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
2741 glClear(GL_COLOR_BUFFER_BIT);
2742 decoder_->RestoreClearState();
2743 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
2744 GL_RENDERBUFFER, 0);
piman 2016/06/27 19:37:36 nit: ditto.
erikchen 2016/06/27 22:16:03 Done.
2745 }
2746 glDeleteFramebuffersEXT(1, &fbo);
2747 }
2748
2615 bool success = glGetError() == GL_NO_ERROR; 2749 bool success = glGetError() == GL_NO_ERROR;
2616 if (success) { 2750 if (success) {
2617 // Mark the previously allocated bytes as free. 2751 // Mark the previously allocated bytes as free.
2618 memory_tracker_.TrackMemFree(bytes_allocated_); 2752 memory_tracker_.TrackMemFree(bytes_allocated_);
2619 bytes_allocated_ = estimated_size; 2753 bytes_allocated_ = estimated_size;
2620 // Track the newly allocated bytes. 2754 // Track the newly allocated bytes.
2621 memory_tracker_.TrackMemAlloc(bytes_allocated_); 2755 memory_tracker_.TrackMemAlloc(bytes_allocated_);
2622 } 2756 }
2623 return success; 2757 return success;
2624 } 2758 }
2625 2759
2626 void BackRenderbuffer::Destroy() { 2760 void BackRenderbuffer::Destroy() {
2627 if (id_ != 0) { 2761 if (id_ != 0) {
2628 ScopedGLErrorSuppressor suppressor("BackRenderbuffer::Destroy", 2762 ScopedGLErrorSuppressor suppressor("BackRenderbuffer::Destroy",
2629 state_->GetErrorState()); 2763 decoder_->state_.GetErrorState());
2630 glDeleteRenderbuffersEXT(1, &id_); 2764 glDeleteRenderbuffersEXT(1, &id_);
2631 id_ = 0; 2765 id_ = 0;
2632 } 2766 }
2633 memory_tracker_.TrackMemFree(bytes_allocated_); 2767 memory_tracker_.TrackMemFree(bytes_allocated_);
2634 bytes_allocated_ = 0; 2768 bytes_allocated_ = 0;
2635 } 2769 }
2636 2770
2637 void BackRenderbuffer::Invalidate() { 2771 void BackRenderbuffer::Invalidate() {
2638 id_ = 0; 2772 id_ = 0;
2639 } 2773 }
(...skipping 16 matching lines...) Expand all
2656 Destroy(); 2790 Destroy();
2657 glGenFramebuffersEXT(1, &id_); 2791 glGenFramebuffersEXT(1, &id_);
2658 } 2792 }
2659 2793
2660 void BackFramebuffer::AttachRenderTexture(BackTexture* texture) { 2794 void BackFramebuffer::AttachRenderTexture(BackTexture* texture) {
2661 DCHECK_NE(id_, 0u); 2795 DCHECK_NE(id_, 0u);
2662 ScopedGLErrorSuppressor suppressor( 2796 ScopedGLErrorSuppressor suppressor(
2663 "BackFramebuffer::AttachRenderTexture", decoder_->GetErrorState()); 2797 "BackFramebuffer::AttachRenderTexture", decoder_->GetErrorState());
2664 ScopedFrameBufferBinder binder(decoder_, id_); 2798 ScopedFrameBufferBinder binder(decoder_, id_);
2665 GLuint attach_id = texture ? texture->id() : 0; 2799 GLuint attach_id = texture ? texture->id() : 0;
2666 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, 2800 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
2667 GL_COLOR_ATTACHMENT0, 2801 texture->Target(), attach_id, 0);
2668 GL_TEXTURE_2D,
2669 attach_id,
2670 0);
2671 } 2802 }
2672 2803
2673 void BackFramebuffer::AttachRenderBuffer(GLenum target, 2804 void BackFramebuffer::AttachRenderBuffer(GLenum target,
2674 BackRenderbuffer* render_buffer) { 2805 BackRenderbuffer* render_buffer) {
2675 DCHECK_NE(id_, 0u); 2806 DCHECK_NE(id_, 0u);
2676 ScopedGLErrorSuppressor suppressor( 2807 ScopedGLErrorSuppressor suppressor(
2677 "BackFramebuffer::AttachRenderBuffer", decoder_->GetErrorState()); 2808 "BackFramebuffer::AttachRenderBuffer", decoder_->GetErrorState());
2678 ScopedFrameBufferBinder binder(decoder_, id_); 2809 ScopedFrameBufferBinder binder(decoder_, id_);
2679 GLuint attach_id = render_buffer ? render_buffer->id() : 0; 2810 GLuint attach_id = render_buffer ? render_buffer->id() : 0;
2680 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, 2811 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 attrib_0_buffer_matches_value_(true), 2851 attrib_0_buffer_matches_value_(true),
2721 attrib_0_size_(0), 2852 attrib_0_size_(0),
2722 fixed_attrib_buffer_id_(0), 2853 fixed_attrib_buffer_id_(0),
2723 fixed_attrib_buffer_size_(0), 2854 fixed_attrib_buffer_size_(0),
2724 offscreen_target_color_format_(0), 2855 offscreen_target_color_format_(0),
2725 offscreen_target_depth_format_(0), 2856 offscreen_target_depth_format_(0),
2726 offscreen_target_stencil_format_(0), 2857 offscreen_target_stencil_format_(0),
2727 offscreen_target_samples_(0), 2858 offscreen_target_samples_(0),
2728 offscreen_target_buffer_preserved_(true), 2859 offscreen_target_buffer_preserved_(true),
2729 offscreen_saved_color_format_(0), 2860 offscreen_saved_color_format_(0),
2861 offscreen_buffer_should_have_alpha_(false),
2730 back_buffer_color_format_(0), 2862 back_buffer_color_format_(0),
2731 back_buffer_has_depth_(false), 2863 back_buffer_has_depth_(false),
2732 back_buffer_has_stencil_(false), 2864 back_buffer_has_stencil_(false),
2733 back_buffer_read_buffer_(GL_BACK), 2865 back_buffer_read_buffer_(GL_BACK),
2734 back_buffer_draw_buffer_(GL_BACK), 2866 back_buffer_draw_buffer_(GL_BACK),
2735 surfaceless_(false), 2867 surfaceless_(false),
2736 backbuffer_needs_clear_bits_(0), 2868 backbuffer_needs_clear_bits_(0),
2737 swaps_since_resize_(0), 2869 swaps_since_resize_(0),
2738 current_decoder_error_(error::kNoError), 2870 current_decoder_error_(error::kNoError),
2739 validators_(group_->feature_info()->validators()), 2871 validators_(group_->feature_info()->validators()),
2740 feature_info_(group_->feature_info()), 2872 feature_info_(group_->feature_info()),
2741 frame_number_(0), 2873 frame_number_(0),
2742 has_robustness_extension_(false), 2874 has_robustness_extension_(false),
2743 context_lost_reason_(error::kUnknown), 2875 context_lost_reason_(error::kUnknown),
2744 context_was_lost_(false), 2876 context_was_lost_(false),
2745 reset_by_robustness_extension_(false), 2877 reset_by_robustness_extension_(false),
2746 supports_post_sub_buffer_(false), 2878 supports_post_sub_buffer_(false),
2747 supports_commit_overlay_planes_(false), 2879 supports_commit_overlay_planes_(false),
2748 supports_async_swap_(false), 2880 supports_async_swap_(false),
2749 context_type_(CONTEXT_TYPE_OPENGLES2), 2881 context_type_(CONTEXT_TYPE_OPENGLES2),
2750 derivatives_explicitly_enabled_(false), 2882 derivatives_explicitly_enabled_(false),
2751 frag_depth_explicitly_enabled_(false), 2883 frag_depth_explicitly_enabled_(false),
2752 draw_buffers_explicitly_enabled_(false), 2884 draw_buffers_explicitly_enabled_(false),
2753 shader_texture_lod_explicitly_enabled_(false), 2885 shader_texture_lod_explicitly_enabled_(false),
2754 compile_shader_always_succeeds_(false), 2886 compile_shader_always_succeeds_(false),
2755 lose_context_when_out_of_memory_(false), 2887 lose_context_when_out_of_memory_(false),
2888 should_use_native_gmb_for_backbuffer_(false),
2756 service_logging_( 2889 service_logging_(
2757 group_->gpu_preferences().enable_gpu_service_logging_gpu), 2890 group_->gpu_preferences().enable_gpu_service_logging_gpu),
2758 viewport_max_width_(0), 2891 viewport_max_width_(0),
2759 viewport_max_height_(0), 2892 viewport_max_height_(0),
2760 texture_state_(group_->feature_info()->workarounds()), 2893 texture_state_(group_->feature_info()->workarounds()),
2761 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( 2894 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
2762 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))), 2895 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))),
2763 gpu_trace_level_(2), 2896 gpu_trace_level_(2),
2764 gpu_trace_commands_(false), 2897 gpu_trace_commands_(false),
2765 gpu_debug_commands_(false), 2898 gpu_debug_commands_(false),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2811 if (feature_info_->workarounds().disable_timestamp_queries) { 2944 if (feature_info_->workarounds().disable_timestamp_queries) {
2812 // Forcing time elapsed query for any GPU Timing Client forces it for all 2945 // Forcing time elapsed query for any GPU Timing Client forces it for all
2813 // clients in the context. 2946 // clients in the context.
2814 GetGLContext()->CreateGPUTimingClient()->ForceTimeElapsedQuery(); 2947 GetGLContext()->CreateGPUTimingClient()->ForceTimeElapsedQuery();
2815 } 2948 }
2816 2949
2817 // Save the loseContextWhenOutOfMemory context creation attribute. 2950 // Save the loseContextWhenOutOfMemory context creation attribute.
2818 lose_context_when_out_of_memory_ = 2951 lose_context_when_out_of_memory_ =
2819 attrib_helper.lose_context_when_out_of_memory; 2952 attrib_helper.lose_context_when_out_of_memory;
2820 2953
2954 should_use_native_gmb_for_backbuffer_ =
2955 attrib_helper.should_use_native_gmb_for_backbuffer;
piman 2016/06/27 19:37:37 We need a check of some sort, somewhere. Right now
erikchen 2016/06/27 22:16:04 I added a check here. If should_use_native_gmb_for
2956
2821 // If the failIfMajorPerformanceCaveat context creation attribute was true 2957 // If the failIfMajorPerformanceCaveat context creation attribute was true
2822 // and we are using a software renderer, fail. 2958 // and we are using a software renderer, fail.
2823 if (attrib_helper.fail_if_major_perf_caveat && 2959 if (attrib_helper.fail_if_major_perf_caveat &&
2824 feature_info_->feature_flags().is_swiftshader) { 2960 feature_info_->feature_flags().is_swiftshader) {
2825 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. 2961 group_ = NULL; // Must not destroy ContextGroup if it is not initialized.
2826 Destroy(true); 2962 Destroy(true);
2827 return false; 2963 return false;
2828 } 2964 }
2829 2965
2830 if (!group_->Initialize(this, attrib_helper.context_type, 2966 if (!group_->Initialize(this, attrib_helper.context_type,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2929 state_.texture_units[tt].bound_texture_2d = ref; 3065 state_.texture_units[tt].bound_texture_2d = ref;
2930 glBindTexture(GL_TEXTURE_2D, ref ? ref->service_id() : 0); 3066 glBindTexture(GL_TEXTURE_2D, ref ? ref->service_id() : 0);
2931 } 3067 }
2932 glActiveTexture(GL_TEXTURE0); 3068 glActiveTexture(GL_TEXTURE0);
2933 CHECK_GL_ERROR(); 3069 CHECK_GL_ERROR();
2934 3070
2935 // cache ALPHA_BITS result for re-use with clear behaviour 3071 // cache ALPHA_BITS result for re-use with clear behaviour
2936 GLint alpha_bits = 0; 3072 GLint alpha_bits = 0;
2937 3073
2938 if (offscreen) { 3074 if (offscreen) {
3075 offscreen_buffer_should_have_alpha_ = attrib_helper.alpha_size > 0;
3076
3077 // Whether the offscreen buffer texture should have an alpha channel. Does
3078 // not include logic from workarounds.
3079 bool offscreen_buffer_texture_needs_alpha =
3080 offscreen_buffer_should_have_alpha_ ||
3081 (ChromiumImageNeedsRGBEmulation() &&
3082 attrib_helper.should_use_native_gmb_for_backbuffer);
3083
2939 if (attrib_helper.samples > 0 && attrib_helper.sample_buffers > 0 && 3084 if (attrib_helper.samples > 0 && attrib_helper.sample_buffers > 0 &&
2940 features().chromium_framebuffer_multisample) { 3085 features().chromium_framebuffer_multisample) {
2941 // Per ext_framebuffer_multisample spec, need max bound on sample count. 3086 // Per ext_framebuffer_multisample spec, need max bound on sample count.
2942 // max_sample_count must be initialized to a sane value. If 3087 // max_sample_count must be initialized to a sane value. If
2943 // glGetIntegerv() throws a GL error, it leaves its argument unchanged. 3088 // glGetIntegerv() throws a GL error, it leaves its argument unchanged.
2944 GLint max_sample_count = 1; 3089 GLint max_sample_count = 1;
2945 glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count); 3090 glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count);
2946 offscreen_target_samples_ = std::min(attrib_helper.samples, 3091 offscreen_target_samples_ = std::min(attrib_helper.samples,
2947 max_sample_count); 3092 max_sample_count);
2948 } else { 3093 } else {
2949 offscreen_target_samples_ = 1; 3094 offscreen_target_samples_ = 1;
2950 } 3095 }
2951 offscreen_target_buffer_preserved_ = attrib_helper.buffer_preserved; 3096 offscreen_target_buffer_preserved_ = attrib_helper.buffer_preserved;
2952 3097
2953 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) { 3098 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) {
2954 const bool rgb8_supported = 3099 const bool rgb8_supported =
2955 context_->HasExtension("GL_OES_rgb8_rgba8"); 3100 context_->HasExtension("GL_OES_rgb8_rgba8");
2956 // The only available default render buffer formats in GLES2 have very 3101 // The only available default render buffer formats in GLES2 have very
2957 // little precision. Don't enable multisampling unless 8-bit render 3102 // little precision. Don't enable multisampling unless 8-bit render
2958 // buffer formats are available--instead fall back to 8-bit textures. 3103 // buffer formats are available--instead fall back to 8-bit textures.
2959 if (rgb8_supported && offscreen_target_samples_ > 1) { 3104 if (rgb8_supported && offscreen_target_samples_ > 1) {
2960 offscreen_target_color_format_ = attrib_helper.alpha_size > 0 ? 3105 offscreen_target_color_format_ =
2961 GL_RGBA8 : GL_RGB8; 3106 offscreen_buffer_texture_needs_alpha ? GL_RGBA8 : GL_RGB8;
2962 } else { 3107 } else {
2963 offscreen_target_samples_ = 1; 3108 offscreen_target_samples_ = 1;
2964 offscreen_target_color_format_ = 3109 offscreen_target_color_format_ =
2965 attrib_helper.alpha_size > 0 || workarounds().disable_gl_rgb_format 3110 offscreen_buffer_texture_needs_alpha ||
3111 workarounds().disable_gl_rgb_format
2966 ? GL_RGBA 3112 ? GL_RGBA
2967 : GL_RGB; 3113 : GL_RGB;
2968 } 3114 }
2969 3115
2970 // ANGLE only supports packed depth/stencil formats, so use it if it is 3116 // ANGLE only supports packed depth/stencil formats, so use it if it is
2971 // available. 3117 // available.
2972 const bool depth24_stencil8_supported = 3118 const bool depth24_stencil8_supported =
2973 feature_info_->feature_flags().packed_depth24_stencil8; 3119 feature_info_->feature_flags().packed_depth24_stencil8;
2974 VLOG(1) << "GL_OES_packed_depth_stencil " 3120 VLOG(1) << "GL_OES_packed_depth_stencil "
2975 << (depth24_stencil8_supported ? "" : "not ") << "supported."; 3121 << (depth24_stencil8_supported ? "" : "not ") << "supported.";
2976 if ((attrib_helper.depth_size > 0 || attrib_helper.stencil_size > 0) && 3122 if ((attrib_helper.depth_size > 0 || attrib_helper.stencil_size > 0) &&
2977 depth24_stencil8_supported) { 3123 depth24_stencil8_supported) {
2978 offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8; 3124 offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8;
2979 offscreen_target_stencil_format_ = 0; 3125 offscreen_target_stencil_format_ = 0;
2980 } else { 3126 } else {
2981 // It may be the case that this depth/stencil combination is not 3127 // It may be the case that this depth/stencil combination is not
2982 // supported, but this will be checked later by CheckFramebufferStatus. 3128 // supported, but this will be checked later by CheckFramebufferStatus.
2983 offscreen_target_depth_format_ = attrib_helper.depth_size > 0 ? 3129 offscreen_target_depth_format_ = attrib_helper.depth_size > 0 ?
2984 GL_DEPTH_COMPONENT16 : 0; 3130 GL_DEPTH_COMPONENT16 : 0;
2985 offscreen_target_stencil_format_ = attrib_helper.stencil_size > 0 ? 3131 offscreen_target_stencil_format_ = attrib_helper.stencil_size > 0 ?
2986 GL_STENCIL_INDEX8 : 0; 3132 GL_STENCIL_INDEX8 : 0;
2987 } 3133 }
2988 } else { 3134 } else {
2989 offscreen_target_color_format_ = 3135 offscreen_target_color_format_ =
2990 attrib_helper.alpha_size > 0 || workarounds().disable_gl_rgb_format 3136 offscreen_buffer_texture_needs_alpha ||
3137 workarounds().disable_gl_rgb_format
2991 ? GL_RGBA 3138 ? GL_RGBA
2992 : GL_RGB; 3139 : GL_RGB;
2993 3140
2994 // If depth is requested at all, use the packed depth stencil format if 3141 // If depth is requested at all, use the packed depth stencil format if
2995 // it's available, as some desktop GL drivers don't support any non-packed 3142 // it's available, as some desktop GL drivers don't support any non-packed
2996 // formats for depth attachments. 3143 // formats for depth attachments.
2997 const bool depth24_stencil8_supported = 3144 const bool depth24_stencil8_supported =
2998 feature_info_->feature_flags().packed_depth24_stencil8; 3145 feature_info_->feature_flags().packed_depth24_stencil8;
2999 VLOG(1) << "GL_EXT_packed_depth_stencil " 3146 VLOG(1) << "GL_EXT_packed_depth_stencil "
3000 << (depth24_stencil8_supported ? "" : "not ") << "supported."; 3147 << (depth24_stencil8_supported ? "" : "not ") << "supported.";
3001 3148
3002 if ((attrib_helper.depth_size > 0 || attrib_helper.stencil_size > 0) && 3149 if ((attrib_helper.depth_size > 0 || attrib_helper.stencil_size > 0) &&
3003 depth24_stencil8_supported) { 3150 depth24_stencil8_supported) {
3004 offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8; 3151 offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8;
3005 offscreen_target_stencil_format_ = 0; 3152 offscreen_target_stencil_format_ = 0;
3006 } else { 3153 } else {
3007 offscreen_target_depth_format_ = attrib_helper.depth_size > 0 ? 3154 offscreen_target_depth_format_ = attrib_helper.depth_size > 0 ?
3008 GL_DEPTH_COMPONENT : 0; 3155 GL_DEPTH_COMPONENT : 0;
3009 offscreen_target_stencil_format_ = attrib_helper.stencil_size > 0 ? 3156 offscreen_target_stencil_format_ = attrib_helper.stencil_size > 0 ?
3010 GL_STENCIL_INDEX : 0; 3157 GL_STENCIL_INDEX : 0;
3011 } 3158 }
3012 } 3159 }
3013 3160
3014 offscreen_saved_color_format_ = 3161 offscreen_saved_color_format_ = offscreen_buffer_texture_needs_alpha ||
3015 attrib_helper.alpha_size > 0 || workarounds().disable_gl_rgb_format 3162 workarounds().disable_gl_rgb_format
3016 ? GL_RGBA 3163 ? GL_RGBA
3017 : GL_RGB; 3164 : GL_RGB;
3018 3165
3019 // Create the target frame buffer. This is the one that the client renders 3166 // Create the target frame buffer. This is the one that the client renders
3020 // directly to. 3167 // directly to.
3021 offscreen_target_frame_buffer_.reset(new BackFramebuffer(this)); 3168 offscreen_target_frame_buffer_.reset(new BackFramebuffer(this));
3022 offscreen_target_frame_buffer_->Create(); 3169 offscreen_target_frame_buffer_->Create();
3023 // Due to GLES2 format limitations, either the color texture (for 3170 // Due to GLES2 format limitations, either the color texture (for
3024 // non-multisampling) or the color render buffer (for multisampling) will be 3171 // non-multisampling) or the color render buffer (for multisampling) will be
3025 // attached to the offscreen frame buffer. The render buffer has more 3172 // attached to the offscreen frame buffer. The render buffer has more
3026 // limited formats available to it, but the texture can't do multisampling. 3173 // limited formats available to it, but the texture can't do multisampling.
3027 if (IsOffscreenBufferMultisampled()) { 3174 if (IsOffscreenBufferMultisampled()) {
3028 offscreen_target_color_render_buffer_.reset(new BackRenderbuffer( 3175 offscreen_target_color_render_buffer_.reset(new BackRenderbuffer(this));
3029 renderbuffer_manager(), memory_tracker(), &state_));
3030 offscreen_target_color_render_buffer_->Create(); 3176 offscreen_target_color_render_buffer_->Create();
3031 } else { 3177 } else {
3032 offscreen_target_color_texture_.reset(new BackTexture(this)); 3178 offscreen_target_color_texture_.reset(new BackTexture(this));
3033 offscreen_target_color_texture_->Create(); 3179 offscreen_target_color_texture_->Create();
3034 } 3180 }
3035 offscreen_target_depth_render_buffer_.reset(new BackRenderbuffer( 3181 offscreen_target_depth_render_buffer_.reset(new BackRenderbuffer(this));
3036 renderbuffer_manager(), memory_tracker(), &state_));
3037 offscreen_target_depth_render_buffer_->Create(); 3182 offscreen_target_depth_render_buffer_->Create();
3038 offscreen_target_stencil_render_buffer_.reset(new BackRenderbuffer( 3183 offscreen_target_stencil_render_buffer_.reset(new BackRenderbuffer(this));
3039 renderbuffer_manager(), memory_tracker(), &state_));
3040 offscreen_target_stencil_render_buffer_->Create(); 3184 offscreen_target_stencil_render_buffer_->Create();
3041 3185
3042 // Create the saved offscreen texture. The target frame buffer is copied 3186 // Create the saved offscreen texture. The target frame buffer is copied
3043 // here when SwapBuffers is called. 3187 // here when SwapBuffers is called.
3044 offscreen_saved_frame_buffer_.reset(new BackFramebuffer(this)); 3188 offscreen_saved_frame_buffer_.reset(new BackFramebuffer(this));
3045 offscreen_saved_frame_buffer_->Create(); 3189 offscreen_saved_frame_buffer_->Create();
3046 // 3190 //
3047 offscreen_saved_color_texture_.reset(new BackTexture(this)); 3191 offscreen_saved_color_texture_.reset(new BackTexture(this));
3048 offscreen_saved_color_texture_->Create(); 3192 offscreen_saved_color_texture_->Create();
3049 3193
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3342 feature_info_->feature_flags().oes_compressed_etc1_rgb8_texture; 3486 feature_info_->feature_flags().oes_compressed_etc1_rgb8_texture;
3343 caps.texture_format_etc1_npot = 3487 caps.texture_format_etc1_npot =
3344 caps.texture_format_etc1 && !workarounds().etc1_power_of_two_only; 3488 caps.texture_format_etc1 && !workarounds().etc1_power_of_two_only;
3345 caps.texture_rectangle = feature_info_->feature_flags().arb_texture_rectangle; 3489 caps.texture_rectangle = feature_info_->feature_flags().arb_texture_rectangle;
3346 caps.texture_usage = feature_info_->feature_flags().angle_texture_usage; 3490 caps.texture_usage = feature_info_->feature_flags().angle_texture_usage;
3347 caps.texture_storage = feature_info_->feature_flags().ext_texture_storage; 3491 caps.texture_storage = feature_info_->feature_flags().ext_texture_storage;
3348 caps.discard_framebuffer = 3492 caps.discard_framebuffer =
3349 feature_info_->feature_flags().ext_discard_framebuffer; 3493 feature_info_->feature_flags().ext_discard_framebuffer;
3350 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; 3494 caps.sync_query = feature_info_->feature_flags().chromium_sync_query;
3351 3495
3496 caps.chromium_image_rgb_emulation = ChromiumImageNeedsRGBEmulation();
3352 #if defined(OS_MACOSX) 3497 #if defined(OS_MACOSX)
3353 // This is unconditionally true on mac, no need to test for it at runtime. 3498 // This is unconditionally true on mac, no need to test for it at runtime.
3354 caps.iosurface = true; 3499 caps.iosurface = true;
3355 caps.chromium_image_rgb_emulation = true;
3356 #endif 3500 #endif
3357 3501
3358 caps.post_sub_buffer = supports_post_sub_buffer_; 3502 caps.post_sub_buffer = supports_post_sub_buffer_;
3359 caps.commit_overlay_planes = supports_commit_overlay_planes_; 3503 caps.commit_overlay_planes = supports_commit_overlay_planes_;
3360 caps.image = true; 3504 caps.image = true;
3361 caps.surfaceless = surfaceless_; 3505 caps.surfaceless = surfaceless_;
3362 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); 3506 bool is_offscreen = !!offscreen_target_frame_buffer_.get();
3363 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); 3507 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically();
3364 caps.msaa_is_slow = feature_info_->workarounds().msaa_is_slow; 3508 caps.msaa_is_slow = feature_info_->workarounds().msaa_is_slow;
3365 3509
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
3908 bool GLES2DecoderImpl::CheckFramebufferValid( 4052 bool GLES2DecoderImpl::CheckFramebufferValid(
3909 Framebuffer* framebuffer, 4053 Framebuffer* framebuffer,
3910 GLenum target, 4054 GLenum target,
3911 bool clear_uncleared_images, 4055 bool clear_uncleared_images,
3912 GLenum gl_error, 4056 GLenum gl_error,
3913 const char* func_name) { 4057 const char* func_name) {
3914 if (!framebuffer) { 4058 if (!framebuffer) {
3915 if (surfaceless_) 4059 if (surfaceless_)
3916 return false; 4060 return false;
3917 if (backbuffer_needs_clear_bits_ && clear_uncleared_images) { 4061 if (backbuffer_needs_clear_bits_ && clear_uncleared_images) {
3918 glClearColor(0, 0, 0, BackBufferHasAlpha() ? 0 : 1.f); 4062 glClearColor(0, 0, 0, BackBufferAlphaClearColor());
3919 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 4063 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
3920 glClearStencil(0); 4064 glClearStencil(0);
3921 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask); 4065 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
3922 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask); 4066 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
3923 glClearDepth(1.0f); 4067 glClearDepth(1.0f);
3924 state_.SetDeviceDepthMask(GL_TRUE); 4068 state_.SetDeviceDepthMask(GL_TRUE);
3925 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); 4069 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
3926 bool reset_draw_buffer = false; 4070 bool reset_draw_buffer = false;
3927 if ((backbuffer_needs_clear_bits_ & GL_COLOR_BUFFER_BIT) != 0 && 4071 if ((backbuffer_needs_clear_bits_ & GL_COLOR_BUFFER_BIT) != 0 &&
3928 back_buffer_draw_buffer_ == GL_NONE) { 4072 back_buffer_draw_buffer_ == GL_NONE) {
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
4575 if (w < 0 || h < 0 || h >= (INT_MAX / 4) / (w ? w : 1)) { 4719 if (w < 0 || h < 0 || h >= (INT_MAX / 4) / (w ? w : 1)) {
4576 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " 4720 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "
4577 << "to allocate storage due to excessive dimensions."; 4721 << "to allocate storage due to excessive dimensions.";
4578 return false; 4722 return false;
4579 } 4723 }
4580 4724
4581 // Reallocate the offscreen target buffers. 4725 // Reallocate the offscreen target buffers.
4582 DCHECK(offscreen_target_color_format_); 4726 DCHECK(offscreen_target_color_format_);
4583 if (IsOffscreenBufferMultisampled()) { 4727 if (IsOffscreenBufferMultisampled()) {
4584 if (!offscreen_target_color_render_buffer_->AllocateStorage( 4728 if (!offscreen_target_color_render_buffer_->AllocateStorage(
4585 feature_info_.get(), 4729 feature_info_.get(), offscreen_size_,
4586 offscreen_size_, 4730 offscreen_target_color_format_, offscreen_target_samples_)) {
4587 offscreen_target_color_format_,
4588 offscreen_target_samples_)) {
4589 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " 4731 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "
4590 << "to allocate storage for offscreen target color buffer."; 4732 << "to allocate storage for offscreen target color buffer.";
4591 return false; 4733 return false;
4592 } 4734 }
4593 } else { 4735 } else {
4594 if (!offscreen_target_color_texture_->AllocateStorage( 4736 if (!offscreen_target_color_texture_->AllocateStorage(
4595 offscreen_size_, offscreen_target_color_format_, false)) { 4737 offscreen_size_, offscreen_target_color_format_, false)) {
4596 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " 4738 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "
4597 << "to allocate storage for offscreen target color texture."; 4739 << "to allocate storage for offscreen target color texture.";
4598 return false; 4740 return false;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
4648 if (offscreen_target_frame_buffer_->CheckStatus() != 4790 if (offscreen_target_frame_buffer_->CheckStatus() !=
4649 GL_FRAMEBUFFER_COMPLETE) { 4791 GL_FRAMEBUFFER_COMPLETE) {
4650 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " 4792 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "
4651 << "because offscreen FBO was incomplete."; 4793 << "because offscreen FBO was incomplete.";
4652 return false; 4794 return false;
4653 } 4795 }
4654 4796
4655 // Clear the target frame buffer. 4797 // Clear the target frame buffer.
4656 { 4798 {
4657 ScopedFrameBufferBinder binder(this, offscreen_target_frame_buffer_->id()); 4799 ScopedFrameBufferBinder binder(this, offscreen_target_frame_buffer_->id());
4658 glClearColor(0, 0, 0, BackBufferHasAlpha() ? 0 : 1.f); 4800 glClearColor(0, 0, 0, BackBufferAlphaClearColor());
4659 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 4801 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
4660 glClearStencil(0); 4802 glClearStencil(0);
4661 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask); 4803 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
4662 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask); 4804 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
4663 glClearDepth(0); 4805 glClearDepth(0);
4664 state_.SetDeviceDepthMask(GL_TRUE); 4806 state_.SetDeviceDepthMask(GL_TRUE);
4665 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); 4807 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
4666 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 4808 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
4667 RestoreClearState(); 4809 RestoreClearState();
4668 } 4810 }
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
5031 } 5173 }
5032 5174
5033 void GLES2DecoderImpl::DoBindBufferRange(GLenum target, GLuint index, 5175 void GLES2DecoderImpl::DoBindBufferRange(GLenum target, GLuint index,
5034 GLuint client_id, 5176 GLuint client_id,
5035 GLintptr offset, 5177 GLintptr offset,
5036 GLsizeiptr size) { 5178 GLsizeiptr size) {
5037 BindIndexedBufferImpl(target, index, client_id, offset, size, 5179 BindIndexedBufferImpl(target, index, client_id, offset, size,
5038 kBindBufferRange, "glBindBufferRange"); 5180 kBindBufferRange, "glBindBufferRange");
5039 } 5181 }
5040 5182
5041 bool GLES2DecoderImpl::BoundFramebufferHasColorAttachmentWithAlpha() { 5183 bool GLES2DecoderImpl::BoundFramebufferAllowsChangesToAlphaChannel() {
5042 Framebuffer* framebuffer = 5184 Framebuffer* framebuffer =
5043 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); 5185 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
5044 if (framebuffer) 5186 if (framebuffer)
5045 return framebuffer->HasAlphaMRT(); 5187 return framebuffer->HasAlphaMRT();
5046 return BackBufferHasAlpha(); 5188 if (back_buffer_draw_buffer_ == GL_NONE)
5189 return false;
5190 if (offscreen_target_frame_buffer_.get()) {
5191 GLenum format = offscreen_target_color_format_;
5192 return (format == GL_RGBA || format == GL_RGBA8) &&
5193 offscreen_buffer_should_have_alpha_;
5194 }
5195 return (back_buffer_color_format_ == GL_RGBA ||
5196 back_buffer_color_format_ == GL_RGBA8);
5047 } 5197 }
5048 5198
5049 bool GLES2DecoderImpl::BoundFramebufferHasDepthAttachment() { 5199 bool GLES2DecoderImpl::BoundFramebufferHasDepthAttachment() {
5050 Framebuffer* framebuffer = 5200 Framebuffer* framebuffer =
5051 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); 5201 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
5052 if (framebuffer) { 5202 if (framebuffer) {
5053 return framebuffer->HasDepthAttachment(); 5203 return framebuffer->HasDepthAttachment();
5054 } 5204 }
5055 if (offscreen_target_frame_buffer_.get()) { 5205 if (offscreen_target_frame_buffer_.get()) {
5056 return offscreen_target_depth_format_ != 0; 5206 return offscreen_target_depth_format_ != 0;
5057 } 5207 }
5058 return back_buffer_has_depth_; 5208 return back_buffer_has_depth_;
5059 } 5209 }
5060 5210
5061 bool GLES2DecoderImpl::BoundFramebufferHasStencilAttachment() { 5211 bool GLES2DecoderImpl::BoundFramebufferHasStencilAttachment() {
5062 Framebuffer* framebuffer = 5212 Framebuffer* framebuffer =
5063 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); 5213 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
5064 if (framebuffer) { 5214 if (framebuffer) {
5065 return framebuffer->HasStencilAttachment(); 5215 return framebuffer->HasStencilAttachment();
5066 } 5216 }
5067 if (offscreen_target_frame_buffer_.get()) { 5217 if (offscreen_target_frame_buffer_.get()) {
5068 return offscreen_target_stencil_format_ != 0 || 5218 return offscreen_target_stencil_format_ != 0 ||
5069 offscreen_target_depth_format_ == GL_DEPTH24_STENCIL8; 5219 offscreen_target_depth_format_ == GL_DEPTH24_STENCIL8;
5070 } 5220 }
5071 return back_buffer_has_stencil_; 5221 return back_buffer_has_stencil_;
5072 } 5222 }
5073 5223
5074 void GLES2DecoderImpl::ApplyDirtyState() { 5224 void GLES2DecoderImpl::ApplyDirtyState() {
5075 if (framebuffer_state_.clear_state_dirty) { 5225 if (framebuffer_state_.clear_state_dirty) {
5076 bool have_alpha = BoundFramebufferHasColorAttachmentWithAlpha(); 5226 bool allows_alpha_change = BoundFramebufferAllowsChangesToAlphaChannel();
5077 state_.SetDeviceColorMask(state_.color_mask_red, 5227 state_.SetDeviceColorMask(state_.color_mask_red, state_.color_mask_green,
5078 state_.color_mask_green,
5079 state_.color_mask_blue, 5228 state_.color_mask_blue,
5080 state_.color_mask_alpha && have_alpha); 5229 state_.color_mask_alpha && allows_alpha_change);
5081 5230
5082 bool have_depth = BoundFramebufferHasDepthAttachment(); 5231 bool have_depth = BoundFramebufferHasDepthAttachment();
5083 state_.SetDeviceDepthMask(state_.depth_mask && have_depth); 5232 state_.SetDeviceDepthMask(state_.depth_mask && have_depth);
5084 5233
5085 bool have_stencil = BoundFramebufferHasStencilAttachment(); 5234 bool have_stencil = BoundFramebufferHasStencilAttachment();
5086 state_.SetDeviceStencilMaskSeparate( 5235 state_.SetDeviceStencilMaskSeparate(
5087 GL_FRONT, have_stencil ? state_.stencil_front_writemask : 0); 5236 GL_FRONT, have_stencil ? state_.stencil_front_writemask : 0);
5088 state_.SetDeviceStencilMaskSeparate( 5237 state_.SetDeviceStencilMaskSeparate(
5089 GL_BACK, have_stencil ? state_.stencil_back_writemask : 0); 5238 GL_BACK, have_stencil ? state_.stencil_back_writemask : 0);
5090 5239
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
5861 framebuffer->HasSameInternalFormatsMRT()) { 6010 framebuffer->HasSameInternalFormatsMRT()) {
5862 if (feature_info_->gl_version_info().is_desktop_core_profile) { 6011 if (feature_info_->gl_version_info().is_desktop_core_profile) {
5863 glGetFramebufferAttachmentParameterivEXT( 6012 glGetFramebufferAttachmentParameterivEXT(
5864 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 6013 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
5865 GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &v); 6014 GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &v);
5866 } else { 6015 } else {
5867 glGetIntegerv(GL_ALPHA_BITS, &v); 6016 glGetIntegerv(GL_ALPHA_BITS, &v);
5868 } 6017 }
5869 } 6018 }
5870 } else { 6019 } else {
5871 v = (BackBufferHasAlpha() ? 8 : 0); 6020 v = (ClientExposedBackBufferHasAlpha() ? 8 : 0);
5872 } 6021 }
5873 params[0] = v; 6022 params[0] = v;
5874 } 6023 }
5875 return true; 6024 return true;
5876 case GL_DEPTH_BITS: 6025 case GL_DEPTH_BITS:
5877 *num_written = 1; 6026 *num_written = 1;
5878 if (params) { 6027 if (params) {
5879 GLint v = 0; 6028 GLint v = 0;
5880 if (feature_info_->gl_version_info().is_desktop_core_profile) { 6029 if (feature_info_->gl_version_info().is_desktop_core_profile) {
5881 Framebuffer* framebuffer = 6030 Framebuffer* framebuffer =
(...skipping 7340 matching lines...) Expand 10 before | Expand all | Expand 10 after
13222 MarkContextLost(error::kUnknown); 13371 MarkContextLost(error::kUnknown);
13223 group_->LoseContexts(error::kUnknown); 13372 group_->LoseContexts(error::kUnknown);
13224 return; 13373 return;
13225 } 13374 }
13226 13375
13227 // Clear the offscreen color texture. 13376 // Clear the offscreen color texture.
13228 // TODO(piman): Is this still necessary? 13377 // TODO(piman): Is this still necessary?
13229 { 13378 {
13230 ScopedFrameBufferBinder binder(this, 13379 ScopedFrameBufferBinder binder(this,
13231 offscreen_saved_frame_buffer_->id()); 13380 offscreen_saved_frame_buffer_->id());
13232 glClearColor(0, 0, 0, 0); 13381 glClearColor(0, 0, 0, BackBufferAlphaClearColor());
13233 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 13382 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
13234 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); 13383 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
13235 glClear(GL_COLOR_BUFFER_BIT); 13384 glClear(GL_COLOR_BUFFER_BIT);
13236 RestoreClearState(); 13385 RestoreClearState();
13237 } 13386 }
13238 } 13387 }
13239 } 13388 }
13240 13389
13241 if (offscreen_size_.width() == 0 || offscreen_size_.height() == 0) 13390 if (offscreen_size_.width() == 0 || offscreen_size_.height() == 0)
13242 return; 13391 return;
(...skipping 3464 matching lines...) Expand 10 before | Expand all | Expand 10 after
16707 // The workaround only works if the source texture consists of the channels 16856 // The workaround only works if the source texture consists of the channels
16708 // kRGB or kRGBA. 16857 // kRGB or kRGBA.
16709 if (channels_exist != GLES2Util::kRGBA && channels_exist != GLES2Util::kRGB) 16858 if (channels_exist != GLES2Util::kRGBA && channels_exist != GLES2Util::kRGB)
16710 return false; 16859 return false;
16711 16860
16712 *source_texture_target = texture->texture()->target(); 16861 *source_texture_target = texture->texture()->target();
16713 *source_texture_service_id = texture->service_id(); 16862 *source_texture_service_id = texture->service_id();
16714 return true; 16863 return true;
16715 } 16864 }
16716 16865
16866 bool GLES2DecoderImpl::ChromiumImageNeedsRGBEmulation() {
16867 #if defined(OS_MACOSX)
piman 2016/06/27 19:37:36 nit: is this something maybe the ImageFactory coul
erikchen 2016/06/27 22:16:03 Done.
16868 return true;
16869 #else
16870 return false;
16871 #endif
16872 }
16873
16717 error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket( 16874 error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket(
16718 uint32_t immediate_data_size, 16875 uint32_t immediate_data_size,
16719 const void* cmd_data) { 16876 const void* cmd_data) {
16720 const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket& c = 16877 const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket& c =
16721 *static_cast<const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket*>( 16878 *static_cast<const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket*>(
16722 cmd_data); 16879 cmd_data);
16723 if (!features().chromium_path_rendering) { 16880 if (!features().chromium_path_rendering) {
16724 return error::kUnknownCommand; 16881 return error::kUnknownCommand;
16725 } 16882 }
16726 16883
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
16870 } 17027 }
16871 17028
16872 // Include the auto-generated part of this file. We split this because it means 17029 // Include the auto-generated part of this file. We split this because it means
16873 // we can easily edit the non-auto generated parts right here in this file 17030 // we can easily edit the non-auto generated parts right here in this file
16874 // instead of having to edit some template or the code generator. 17031 // instead of having to edit some template or the code generator.
16875 #include "base/macros.h" 17032 #include "base/macros.h"
16876 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17033 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16877 17034
16878 } // namespace gles2 17035 } // namespace gles2
16879 } // namespace gpu 17036 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698