| 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/tests/gl_manager.h" | 5 #include "gpu/command_buffer/tests/gl_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "gpu/command_buffer/client/gles2_implementation.h" | 11 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 12 #include "gpu/command_buffer/client/gles2_lib.h" | 12 #include "gpu/command_buffer/client/gles2_lib.h" |
| 13 #include "gpu/command_buffer/client/transfer_buffer.h" | 13 #include "gpu/command_buffer/client/transfer_buffer.h" |
| 14 #include "gpu/command_buffer/common/constants.h" | 14 #include "gpu/command_buffer/common/constants.h" |
| 15 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 15 #include "gpu/command_buffer/service/command_buffer_service.h" | 16 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 16 #include "gpu/command_buffer/service/context_group.h" | 17 #include "gpu/command_buffer/service/context_group.h" |
| 17 #include "gpu/command_buffer/service/gl_context_virtual.h" | 18 #include "gpu/command_buffer/service/gl_context_virtual.h" |
| 18 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 19 #include "gpu/command_buffer/service/gpu_scheduler.h" | 20 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 20 #include "gpu/command_buffer/service/image_manager.h" | 21 #include "gpu/command_buffer/service/image_manager.h" |
| 21 #include "gpu/command_buffer/service/mailbox_manager.h" | 22 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "ui/gl/gl_context.h" | 24 #include "ui/gl/gl_context.h" |
| 24 #include "ui/gl/gl_share_group.h" | 25 #include "ui/gl/gl_share_group.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 context_group = options.share_group_manager->decoder_->GetContextGroup(); | 94 context_group = options.share_group_manager->decoder_->GetContextGroup(); |
| 94 client_share_group = | 95 client_share_group = |
| 95 options.share_group_manager->gles2_implementation()->share_group(); | 96 options.share_group_manager->gles2_implementation()->share_group(); |
| 96 } | 97 } |
| 97 | 98 |
| 98 gfx::GLContext* real_gl_context = NULL; | 99 gfx::GLContext* real_gl_context = NULL; |
| 99 if (options.virtual_manager) { | 100 if (options.virtual_manager) { |
| 100 real_gl_context = options.virtual_manager->context(); | 101 real_gl_context = options.virtual_manager->context(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 // From <EGL/egl.h>. | |
| 104 const int32 EGL_ALPHA_SIZE = 0x3021; | |
| 105 const int32 EGL_BLUE_SIZE = 0x3022; | |
| 106 const int32 EGL_GREEN_SIZE = 0x3023; | |
| 107 const int32 EGL_RED_SIZE = 0x3024; | |
| 108 const int32 EGL_DEPTH_SIZE = 0x3025; | |
| 109 const int32 EGL_NONE = 0x3038; | |
| 110 | |
| 111 mailbox_manager_ = | 104 mailbox_manager_ = |
| 112 mailbox_manager ? mailbox_manager : new gles2::MailboxManager; | 105 mailbox_manager ? mailbox_manager : new gles2::MailboxManager; |
| 113 share_group_ = | 106 share_group_ = |
| 114 share_group ? share_group : new gfx::GLShareGroup; | 107 share_group ? share_group : new gfx::GLShareGroup; |
| 115 | 108 |
| 116 gfx::GpuPreference gpu_preference(gfx::PreferDiscreteGpu); | 109 gfx::GpuPreference gpu_preference(gfx::PreferDiscreteGpu); |
| 117 const char* allowed_extensions = "*"; | 110 const char* allowed_extensions = "*"; |
| 118 std::vector<int32> attribs; | 111 std::vector<int32> attribs; |
| 119 attribs.push_back(EGL_RED_SIZE); | 112 gles2::ContextCreationAttribHelper attrib_helper; |
| 120 attribs.push_back(8); | 113 attrib_helper.red_size_ = 8; |
| 121 attribs.push_back(EGL_GREEN_SIZE); | 114 attrib_helper.green_size_ = 8; |
| 122 attribs.push_back(8); | 115 attrib_helper.blue_size_ = 8; |
| 123 attribs.push_back(EGL_BLUE_SIZE); | 116 attrib_helper.alpha_size_ = 8; |
| 124 attribs.push_back(8); | 117 attrib_helper.depth_size_ = 16; |
| 125 attribs.push_back(EGL_ALPHA_SIZE); | 118 attrib_helper.Serialize(&attribs); |
| 126 attribs.push_back(8); | |
| 127 attribs.push_back(EGL_DEPTH_SIZE); | |
| 128 attribs.push_back(16); | |
| 129 attribs.push_back(EGL_NONE); | |
| 130 | 119 |
| 131 if (!context_group) { | 120 if (!context_group) { |
| 132 context_group = new gles2::ContextGroup(mailbox_manager_.get(), | 121 context_group = new gles2::ContextGroup(mailbox_manager_.get(), |
| 133 options.image_manager, | 122 options.image_manager, |
| 134 NULL, | 123 NULL, |
| 135 NULL, | 124 NULL, |
| 136 options.bind_generates_resource); | 125 options.bind_generates_resource); |
| 137 } | 126 } |
| 138 | 127 |
| 139 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); | 128 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 if (!context_lost_allowed_) { | 253 if (!context_lost_allowed_) { |
| 265 ASSERT_EQ(::gpu::error::kNoError, state.error); | 254 ASSERT_EQ(::gpu::error::kNoError, state.error); |
| 266 } | 255 } |
| 267 } | 256 } |
| 268 | 257 |
| 269 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { | 258 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { |
| 270 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); | 259 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); |
| 271 } | 260 } |
| 272 | 261 |
| 273 } // namespace gpu | 262 } // namespace gpu |
| OLD | NEW |