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