| 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> |
| (...skipping 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2769 return decoder_->should_use_native_gmb_for_backbuffer_ | 2769 return decoder_->should_use_native_gmb_for_backbuffer_ |
| 2770 ? decoder_->GetContextGroup() | 2770 ? decoder_->GetContextGroup() |
| 2771 ->image_factory() | 2771 ->image_factory() |
| 2772 ->RequiredTextureType() | 2772 ->RequiredTextureType() |
| 2773 : GL_TEXTURE_2D; | 2773 : GL_TEXTURE_2D; |
| 2774 } | 2774 } |
| 2775 | 2775 |
| 2776 bool BackTexture::AllocateNativeGpuMemoryBuffer(const gfx::Size& size, | 2776 bool BackTexture::AllocateNativeGpuMemoryBuffer(const gfx::Size& size, |
| 2777 GLenum format, | 2777 GLenum format, |
| 2778 bool zero) { | 2778 bool zero) { |
| 2779 gfx::BufferFormat buffer_format = gfx::BufferFormat::RGBA_8888; | 2779 DCHECK(format == GL_RGB || format == GL_RGBA); |
| 2780 scoped_refptr<gl::GLImage> image = | 2780 scoped_refptr<gl::GLImage> image = |
| 2781 decoder_->GetContextGroup()->image_factory()->CreateAnonymousImage( | 2781 decoder_->GetContextGroup()->image_factory()->CreateAnonymousImage( |
| 2782 size, buffer_format, format); | 2782 size, |
| 2783 format == GL_RGB ? gfx::BufferFormat::RGBX_8888 |
| 2784 : gfx::BufferFormat::RGBA_8888, |
| 2785 format); |
| 2783 if (!image || !image->BindTexImage(Target())) | 2786 if (!image || !image->BindTexImage(Target())) |
| 2784 return false; | 2787 return false; |
| 2785 | 2788 |
| 2786 image_ = image; | 2789 image_ = image; |
| 2787 decoder_->texture_manager()->SetLevelInfo( | 2790 decoder_->texture_manager()->SetLevelInfo( |
| 2788 texture_ref_.get(), Target(), 0, image_->GetInternalFormat(), | 2791 texture_ref_.get(), Target(), 0, image_->GetInternalFormat(), |
| 2789 size.width(), size.height(), 1, 0, image_->GetInternalFormat(), | 2792 size.width(), size.height(), 1, 0, image_->GetInternalFormat(), |
| 2790 GL_UNSIGNED_BYTE, gfx::Rect(size)); | 2793 GL_UNSIGNED_BYTE, gfx::Rect(size)); |
| 2791 decoder_->texture_manager()->SetLevelImage(texture_ref_.get(), Target(), 0, | 2794 decoder_->texture_manager()->SetLevelImage(texture_ref_.get(), Target(), 0, |
| 2792 image_.get(), Texture::BOUND); | 2795 image_.get(), Texture::BOUND); |
| (...skipping 16404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19197 } | 19200 } |
| 19198 | 19201 |
| 19199 // Include the auto-generated part of this file. We split this because it means | 19202 // Include the auto-generated part of this file. We split this because it means |
| 19200 // we can easily edit the non-auto generated parts right here in this file | 19203 // we can easily edit the non-auto generated parts right here in this file |
| 19201 // instead of having to edit some template or the code generator. | 19204 // instead of having to edit some template or the code generator. |
| 19202 #include "base/macros.h" | 19205 #include "base/macros.h" |
| 19203 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19206 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 19204 | 19207 |
| 19205 } // namespace gles2 | 19208 } // namespace gles2 |
| 19206 } // namespace gpu | 19209 } // namespace gpu |
| OLD | NEW |