Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/atomicops.h" | 15 #include "base/atomicops.h" |
| 16 #include "base/at_exit.h" | 16 #include "base/at_exit.h" |
| 17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #include "base/logging.h" | |
| 18 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 21 #define GLES2_GPU_SERVICE 1 | 22 #define GLES2_GPU_SERVICE 1 |
| 22 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 23 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 23 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 24 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 24 #include "gpu/command_buffer/common/id_allocator.h" | 25 #include "gpu/command_buffer/common/id_allocator.h" |
| 25 #include "gpu/command_buffer/common/trace_event.h" | 26 #include "gpu/command_buffer/common/trace_event.h" |
| 26 #include "gpu/command_buffer/service/buffer_manager.h" | 27 #include "gpu/command_buffer/service/buffer_manager.h" |
| 27 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 28 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 28 #include "gpu/command_buffer/service/context_group.h" | 29 #include "gpu/command_buffer/service/context_group.h" |
| 29 #include "gpu/command_buffer/service/feature_info.h" | 30 #include "gpu/command_buffer/service/feature_info.h" |
| 30 #include "gpu/command_buffer/service/framebuffer_manager.h" | 31 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 31 #include "gpu/command_buffer/service/gl_utils.h" | 32 #include "gpu/command_buffer/service/gl_utils.h" |
| 32 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 33 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
| 33 #include "gpu/command_buffer/service/program_manager.h" | 34 #include "gpu/command_buffer/service/program_manager.h" |
| 34 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 35 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
| 35 #include "gpu/command_buffer/service/shader_manager.h" | 36 #include "gpu/command_buffer/service/shader_manager.h" |
| 36 #include "gpu/command_buffer/service/shader_translator.h" | 37 #include "gpu/command_buffer/service/shader_translator.h" |
| 37 #include "gpu/command_buffer/service/texture_manager.h" | 38 #include "gpu/command_buffer/service/texture_manager.h" |
| 38 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 39 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
| 39 #include "ui/gfx/gl/gl_context.h" | 40 #include "ui/gfx/gl/gl_context.h" |
| 40 #include "ui/gfx/gl/gl_implementation.h" | 41 #include "ui/gfx/gl/gl_implementation.h" |
| 41 #include "ui/gfx/gl/gl_surface.h" | 42 #include "ui/gfx/gl/gl_surface.h" |
| 42 | 43 |
| 44 #if defined(USE_X11) | |
| 45 #include "ui/base/x/x11_util.h" | |
|
Ami GONE FROM CHROMIUM
2011/09/20 23:45:51
drop?
dominich
2011/09/21 19:47:30
Done.
| |
| 46 #include "ui/base/x/x11_util_internal.h" | |
| 47 #define CHECK_X_ERROR() ui::CheckFailOnX11Error() | |
|
Ami GONE FROM CHROMIUM
2011/09/20 23:45:51
This makes me sad but I don't have a uniformly bet
dominich
2011/09/21 19:47:30
I agree. I considered putting this in a more obvio
| |
| 48 #else // USE_X11 | |
| 49 #define CHECK_X_ERROR() void(0) | |
| 50 #endif // USE_X11 | |
| 51 | |
| 43 #if !defined(GL_DEPTH24_STENCIL8) | 52 #if !defined(GL_DEPTH24_STENCIL8) |
| 44 #define GL_DEPTH24_STENCIL8 0x88F0 | 53 #define GL_DEPTH24_STENCIL8 0x88F0 |
| 45 #endif | 54 #endif |
| 46 | 55 |
| 47 namespace gpu { | 56 namespace gpu { |
| 48 namespace gles2 { | 57 namespace gles2 { |
| 49 | 58 |
| 50 class GLES2DecoderImpl; | 59 class GLES2DecoderImpl; |
| 51 | 60 |
| 52 // Check that certain assumptions the code makes are true. There are places in | 61 // Check that certain assumptions the code makes are true. There are places in |
| (...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1723 // Take ownership of the GLSurface. TODO(apatrick): once the parent / child | 1732 // Take ownership of the GLSurface. TODO(apatrick): once the parent / child |
| 1724 // context is retired, the decoder should not take an initial surface as | 1733 // context is retired, the decoder should not take an initial surface as |
| 1725 // an argument to this function. | 1734 // an argument to this function. |
| 1726 // Maybe create a short lived offscreen GLSurface for the purpose of | 1735 // Maybe create a short lived offscreen GLSurface for the purpose of |
| 1727 // initializing the decoder's GLContext. | 1736 // initializing the decoder's GLContext. |
| 1728 surface_ = surface; | 1737 surface_ = surface; |
| 1729 | 1738 |
| 1730 // Take ownership of the GLContext. | 1739 // Take ownership of the GLContext. |
| 1731 context_ = context; | 1740 context_ = context; |
| 1732 | 1741 |
| 1742 CHECK_X_ERROR(); | |
| 1743 | |
| 1733 if (!MakeCurrent()) { | 1744 if (!MakeCurrent()) { |
| 1734 LOG(ERROR) << "GLES2DecoderImpl::Initialize failed because " | 1745 LOG(ERROR) << "GLES2DecoderImpl::Initialize failed because " |
| 1735 << "MakeCurrent failed."; | 1746 << "MakeCurrent failed."; |
| 1736 Destroy(); | 1747 Destroy(); |
| 1737 return false; | 1748 return false; |
| 1738 } | 1749 } |
| 1739 | 1750 |
| 1740 if (!group_->Initialize(disallowed_extensions, allowed_extensions)) { | 1751 if (!group_->Initialize(disallowed_extensions, allowed_extensions)) { |
| 1741 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " | 1752 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " |
| 1742 << "failed to initialize."; | 1753 << "failed to initialize."; |
| 1743 Destroy(); | 1754 Destroy(); |
| 1744 return false; | 1755 return false; |
| 1745 } | 1756 } |
| 1746 | 1757 |
| 1758 CHECK_X_ERROR(); | |
| 1747 CHECK_GL_ERROR(); | 1759 CHECK_GL_ERROR(); |
| 1748 disallowed_extensions_ = disallowed_extensions; | 1760 disallowed_extensions_ = disallowed_extensions; |
| 1749 | 1761 |
| 1750 vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); | 1762 vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); |
| 1751 | 1763 |
| 1752 util_.set_num_compressed_texture_formats( | 1764 util_.set_num_compressed_texture_formats( |
| 1753 validators_->compressed_texture_format.GetValues().size()); | 1765 validators_->compressed_texture_format.GetValues().size()); |
| 1754 | 1766 |
| 1755 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { | 1767 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
| 1756 // We have to enable vertex array 0 on OpenGL or it won't render. Note that | 1768 // We have to enable vertex array 0 on OpenGL or it won't render. Note that |
| (...skipping 5113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6870 return false; | 6882 return false; |
| 6871 } | 6883 } |
| 6872 | 6884 |
| 6873 // Include the auto-generated part of this file. We split this because it means | 6885 // Include the auto-generated part of this file. We split this because it means |
| 6874 // we can easily edit the non-auto generated parts right here in this file | 6886 // we can easily edit the non-auto generated parts right here in this file |
| 6875 // instead of having to edit some template or the code generator. | 6887 // instead of having to edit some template or the code generator. |
| 6876 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 6888 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 6877 | 6889 |
| 6878 } // namespace gles2 | 6890 } // namespace gles2 |
| 6879 } // namespace gpu | 6891 } // namespace gpu |
| OLD | NEW |