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 #define Status int | |
46 | |
47 #include "ui/base/x/x11_util.h" | |
48 #include "ui/base/x/x11_util_internal.h" | |
49 #include "ui/gfx/gl/gl_surface_glx.h" | |
50 #define CHECK_X_ERROR() do { \ | |
Ami GONE FROM CHROMIUM
2011/09/14 23:23:11
Why not put this in the x11_util_internal.h header
| |
51 CHECK(!ui::GetLastX11Error(gfx::GLSurfaceGLX::GetDisplay())); \ | |
Ami GONE FROM CHROMIUM
2011/09/14 23:23:11
Can this be simplified by calling XGetDisplay() (i
Ami GONE FROM CHROMIUM
2011/09/14 23:23:11
In fact since this is the only use, you might redu
| |
52 } while(0) | |
53 #else // USE_X11 | |
54 #define CHECK_X_ERROR() void(0) | |
55 #endif // USE_X11 | |
56 | |
43 #if !defined(GL_DEPTH24_STENCIL8) | 57 #if !defined(GL_DEPTH24_STENCIL8) |
44 #define GL_DEPTH24_STENCIL8 0x88F0 | 58 #define GL_DEPTH24_STENCIL8 0x88F0 |
45 #endif | 59 #endif |
46 | 60 |
47 namespace gpu { | 61 namespace gpu { |
48 namespace gles2 { | 62 namespace gles2 { |
49 | 63 |
50 class GLES2DecoderImpl; | 64 class GLES2DecoderImpl; |
51 | 65 |
52 // Check that certain assumptions the code makes are true. There are places in | 66 // 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 | 1737 // Take ownership of the GLSurface. TODO(apatrick): once the parent / child |
1724 // context is retired, the decoder should not take an initial surface as | 1738 // context is retired, the decoder should not take an initial surface as |
1725 // an argument to this function. | 1739 // an argument to this function. |
1726 // Maybe create a short lived offscreen GLSurface for the purpose of | 1740 // Maybe create a short lived offscreen GLSurface for the purpose of |
1727 // initializing the decoder's GLContext. | 1741 // initializing the decoder's GLContext. |
1728 surface_ = surface; | 1742 surface_ = surface; |
1729 | 1743 |
1730 // Take ownership of the GLContext. | 1744 // Take ownership of the GLContext. |
1731 context_ = context; | 1745 context_ = context; |
1732 | 1746 |
1747 CHECK_X_ERROR(); | |
1748 | |
1733 if (!MakeCurrent()) { | 1749 if (!MakeCurrent()) { |
1734 LOG(ERROR) << "GLES2DecoderImpl::Initialize failed because " | 1750 LOG(ERROR) << "GLES2DecoderImpl::Initialize failed because " |
1735 << "MakeCurrent failed."; | 1751 << "MakeCurrent failed."; |
1736 Destroy(); | 1752 Destroy(); |
1737 return false; | 1753 return false; |
1738 } | 1754 } |
1739 | 1755 |
1740 if (!group_->Initialize(disallowed_extensions, allowed_extensions)) { | 1756 if (!group_->Initialize(disallowed_extensions, allowed_extensions)) { |
1741 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " | 1757 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " |
1742 << "failed to initialize."; | 1758 << "failed to initialize."; |
1743 Destroy(); | 1759 Destroy(); |
1744 return false; | 1760 return false; |
1745 } | 1761 } |
1746 | 1762 |
1763 CHECK_X_ERROR(); | |
1747 CHECK_GL_ERROR(); | 1764 CHECK_GL_ERROR(); |
1748 disallowed_extensions_ = disallowed_extensions; | 1765 disallowed_extensions_ = disallowed_extensions; |
1749 | 1766 |
1750 vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); | 1767 vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); |
1751 | 1768 |
1752 util_.set_num_compressed_texture_formats( | 1769 util_.set_num_compressed_texture_formats( |
1753 validators_->compressed_texture_format.GetValues().size()); | 1770 validators_->compressed_texture_format.GetValues().size()); |
1754 | 1771 |
1755 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { | 1772 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
1756 // We have to enable vertex array 0 on OpenGL or it won't render. Note that | 1773 // 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; | 6887 return false; |
6871 } | 6888 } |
6872 | 6889 |
6873 // Include the auto-generated part of this file. We split this because it means | 6890 // 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 | 6891 // 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. | 6892 // instead of having to edit some template or the code generator. |
6876 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 6893 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
6877 | 6894 |
6878 } // namespace gles2 | 6895 } // namespace gles2 |
6879 } // namespace gpu | 6896 } // namespace gpu |
OLD | NEW |