| 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 <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 : size(4, 4), | 178 : size(4, 4), |
| 179 sync_point_manager(NULL), | 179 sync_point_manager(NULL), |
| 180 share_group_manager(NULL), | 180 share_group_manager(NULL), |
| 181 share_mailbox_manager(NULL), | 181 share_mailbox_manager(NULL), |
| 182 virtual_manager(NULL), | 182 virtual_manager(NULL), |
| 183 bind_generates_resource(false), | 183 bind_generates_resource(false), |
| 184 lose_context_when_out_of_memory(false), | 184 lose_context_when_out_of_memory(false), |
| 185 context_lost_allowed(false), | 185 context_lost_allowed(false), |
| 186 context_type(gles2::CONTEXT_TYPE_OPENGLES2), | 186 context_type(gles2::CONTEXT_TYPE_OPENGLES2), |
| 187 force_shader_name_hashing(false), | 187 force_shader_name_hashing(false), |
| 188 multisampled(false) {} | 188 multisampled(false), |
| 189 backbuffer_alpha(true), |
| 190 image_factory(nullptr), |
| 191 enable_arb_texture_rectangle(false) {} |
| 189 | 192 |
| 190 GLManager::GLManager() | 193 GLManager::GLManager() |
| 191 : sync_point_manager_(nullptr), | 194 : sync_point_manager_(nullptr), |
| 192 context_lost_allowed_(false), | 195 context_lost_allowed_(false), |
| 193 pause_commands_(false), | 196 pause_commands_(false), |
| 194 paused_order_num_(0), | 197 paused_order_num_(0), |
| 195 command_buffer_id_( | 198 command_buffer_id_( |
| 196 CommandBufferId::FromUnsafeValue(g_next_command_buffer_id++)), | 199 CommandBufferId::FromUnsafeValue(g_next_command_buffer_id++)), |
| 197 next_fence_sync_release_(1) { | 200 next_fence_sync_release_(1) { |
| 198 SetupBaseContext(); | 201 SetupBaseContext(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 gles2::ContextCreationAttribHelper attribs; | 283 gles2::ContextCreationAttribHelper attribs; |
| 281 attribs.red_size = 8; | 284 attribs.red_size = 8; |
| 282 attribs.green_size = 8; | 285 attribs.green_size = 8; |
| 283 attribs.blue_size = 8; | 286 attribs.blue_size = 8; |
| 284 attribs.alpha_size = 8; | 287 attribs.alpha_size = 8; |
| 285 attribs.depth_size = 16; | 288 attribs.depth_size = 16; |
| 286 attribs.stencil_size = 8; | 289 attribs.stencil_size = 8; |
| 287 attribs.context_type = options.context_type; | 290 attribs.context_type = options.context_type; |
| 288 attribs.samples = options.multisampled ? 4 : 0; | 291 attribs.samples = options.multisampled ? 4 : 0; |
| 289 attribs.sample_buffers = options.multisampled ? 1 : 0; | 292 attribs.sample_buffers = options.multisampled ? 1 : 0; |
| 293 attribs.alpha_size = options.backbuffer_alpha ? 8 : 0; |
| 294 attribs.should_use_native_gmb_for_backbuffer = |
| 295 options.image_factory != nullptr; |
| 290 | 296 |
| 291 if (!context_group) { | 297 if (!context_group) { |
| 292 GpuDriverBugWorkarounds gpu_driver_bug_workaround(&command_line); | 298 GpuDriverBugWorkarounds gpu_driver_bug_workaround(&command_line); |
| 293 scoped_refptr<gles2::FeatureInfo> feature_info = | 299 scoped_refptr<gles2::FeatureInfo> feature_info = |
| 294 new gles2::FeatureInfo(command_line, gpu_driver_bug_workaround); | 300 new gles2::FeatureInfo(command_line, gpu_driver_bug_workaround); |
| 301 if (options.enable_arb_texture_rectangle) { |
| 302 gles2::FeatureInfo::FeatureFlags& flags = |
| 303 const_cast<gles2::FeatureInfo::FeatureFlags&>( |
| 304 feature_info->feature_flags()); |
| 305 flags.arb_texture_rectangle = true; |
| 306 } |
| 295 context_group = new gles2::ContextGroup( | 307 context_group = new gles2::ContextGroup( |
| 296 gpu_preferences_, mailbox_manager_.get(), NULL, | 308 gpu_preferences_, mailbox_manager_.get(), NULL, |
| 297 new gpu::gles2::ShaderTranslatorCache(gpu_preferences_), | 309 new gpu::gles2::ShaderTranslatorCache(gpu_preferences_), |
| 298 new gpu::gles2::FramebufferCompletenessCache, feature_info, | 310 new gpu::gles2::FramebufferCompletenessCache, feature_info, |
| 299 options.bind_generates_resource); | 311 options.bind_generates_resource, options.image_factory); |
| 300 } | 312 } |
| 301 | 313 |
| 302 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); | 314 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); |
| 303 if (options.force_shader_name_hashing) { | 315 if (options.force_shader_name_hashing) { |
| 304 decoder_->SetForceShaderNameHashingForTest(true); | 316 decoder_->SetForceShaderNameHashingForTest(true); |
| 305 } | 317 } |
| 306 command_buffer_.reset(new CommandBufferService( | 318 command_buffer_.reset(new CommandBufferService( |
| 307 decoder_->GetContextGroup()->transfer_buffer_manager())); | 319 decoder_->GetContextGroup()->transfer_buffer_manager())); |
| 308 | 320 |
| 309 executor_.reset(new CommandExecutor(command_buffer_.get(), decoder_.get(), | 321 executor_.reset(new CommandExecutor(command_buffer_.get(), decoder_.get(), |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 | 653 |
| 642 // Something went wrong, just run the callback now. | 654 // Something went wrong, just run the callback now. |
| 643 callback.Run(); | 655 callback.Run(); |
| 644 } | 656 } |
| 645 | 657 |
| 646 bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { | 658 bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { |
| 647 return false; | 659 return false; |
| 648 } | 660 } |
| 649 | 661 |
| 650 } // namespace gpu | 662 } // namespace gpu |
| OLD | NEW |