Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: gpu/command_buffer/tests/fuzzer_main.cc

Issue 2629633003: Refactor GL bindings so there is no global GLApi or DriverGL. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include <stddef.h> 4 #include <stddef.h>
5 #include <stdint.h> 5 #include <stdint.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 11 matching lines...) Expand all
22 #include "gpu/command_buffer/service/command_executor.h" 22 #include "gpu/command_buffer/service/command_executor.h"
23 #include "gpu/command_buffer/service/context_group.h" 23 #include "gpu/command_buffer/service/context_group.h"
24 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 24 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
25 #include "gpu/command_buffer/service/logger.h" 25 #include "gpu/command_buffer/service/logger.h"
26 #include "gpu/command_buffer/service/mailbox_manager_impl.h" 26 #include "gpu/command_buffer/service/mailbox_manager_impl.h"
27 #include "gpu/command_buffer/service/sync_point_manager.h" 27 #include "gpu/command_buffer/service/sync_point_manager.h"
28 #include "gpu/command_buffer/service/transfer_buffer_manager.h" 28 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
29 #include "ui/gfx/geometry/size.h" 29 #include "ui/gfx/geometry/size.h"
30 #include "ui/gl/gl_context.h" 30 #include "ui/gl/gl_context.h"
31 #include "ui/gl/gl_context_egl.h" 31 #include "ui/gl/gl_context_egl.h"
32 #include "ui/gl/gl_context_stub_with_extensions.h" 32 #include "ui/gl/gl_context_stub.h"
33 #include "ui/gl/gl_image_ref_counted_memory.h" 33 #include "ui/gl/gl_image_ref_counted_memory.h"
34 #include "ui/gl/gl_share_group.h" 34 #include "ui/gl/gl_share_group.h"
35 #include "ui/gl/gl_stub_api.h" 35 #include "ui/gl/gl_stub_api.h"
36 #include "ui/gl/gl_surface.h" 36 #include "ui/gl/gl_surface.h"
37 #include "ui/gl/gl_surface_egl.h" 37 #include "ui/gl/gl_surface_egl.h"
38 #include "ui/gl/gl_surface_stub.h" 38 #include "ui/gl/gl_surface_stub.h"
39 #include "ui/gl/init/gl_factory.h" 39 #include "ui/gl/init/gl_factory.h"
40 #include "ui/gl/test/gl_surface_test_support.h" 40 #include "ui/gl/test/gl_surface_test_support.h"
41 41
42 namespace gpu { 42 namespace gpu {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 gl::kANGLEImplementationNullName); 104 gl::kANGLEImplementationNullName);
105 gl::init::InitializeGLOneOffImplementation(gl::kGLImplementationEGLGLES2, 105 gl::init::InitializeGLOneOffImplementation(gl::kGLImplementationEGLGLES2,
106 false, false, false); 106 false, false, false);
107 surface_ = new gl::PbufferGLSurfaceEGL(gfx::Size()); 107 surface_ = new gl::PbufferGLSurfaceEGL(gfx::Size());
108 surface_->Initialize(); 108 surface_->Initialize();
109 109
110 context_ = new gl::GLContextEGL(share_group_.get()); 110 context_ = new gl::GLContextEGL(share_group_.get());
111 context_->Initialize(surface_.get(), gl::GLContextAttribs()); 111 context_->Initialize(surface_.get(), gl::GLContextAttribs());
112 #else 112 #else
113 surface_ = new gl::GLSurfaceStub; 113 surface_ = new gl::GLSurfaceStub;
114 context_ = new gl::GLContextStub(share_group_.get()); 114 scoped_refptr<gl::GLContextStub> context_stub =
115 new gl::GLContextStub(share_group_.get());
116 context_stub->SetGLVersionString("OpenGL ES 3.1");
117 context_stub->SetExtensionsString(kExtensions);
118 context_stub->SetUseStubApi(true);
119 context_ = context_stub;
115 gl::GLSurfaceTestSupport::InitializeOneOffWithMockBindings(); 120 gl::GLSurfaceTestSupport::InitializeOneOffWithMockBindings();
116
117 api_ = base::MakeUnique<gl::GLStubApi>();
118 api_->set_version("OpenGL ES 3.1");
119 api_->set_extensions(kExtensions);
120 gl::SetStubGLApi(api_.get());
121 #endif 121 #endif
122 122
123 sync_point_client_ = sync_point_manager_->CreateSyncPointClient( 123 sync_point_client_ = sync_point_manager_->CreateSyncPointClient(
124 sync_point_order_data_, CommandBufferNamespace::IN_PROCESS, 124 sync_point_order_data_, CommandBufferNamespace::IN_PROCESS,
125 command_buffer_id_); 125 command_buffer_id_);
126 126
127 translator_cache_ = new gles2::ShaderTranslatorCache(gpu_preferences_); 127 translator_cache_ = new gles2::ShaderTranslatorCache(gpu_preferences_);
128 completeness_cache_ = new gles2::FramebufferCompletenessCache; 128 completeness_cache_ = new gles2::FramebufferCompletenessCache;
129 } 129 }
130 130
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 std::unique_ptr<SyncPointManager> sync_point_manager_; 284 std::unique_ptr<SyncPointManager> sync_point_manager_;
285 scoped_refptr<SyncPointOrderData> sync_point_order_data_; 285 scoped_refptr<SyncPointOrderData> sync_point_order_data_;
286 std::unique_ptr<SyncPointClient> sync_point_client_; 286 std::unique_ptr<SyncPointClient> sync_point_client_;
287 scoped_refptr<gles2::MailboxManager> mailbox_manager_; 287 scoped_refptr<gles2::MailboxManager> mailbox_manager_;
288 scoped_refptr<gl::GLShareGroup> share_group_; 288 scoped_refptr<gl::GLShareGroup> share_group_;
289 const gpu::CommandBufferId command_buffer_id_; 289 const gpu::CommandBufferId command_buffer_id_;
290 290
291 scoped_refptr<gl::GLSurface> surface_; 291 scoped_refptr<gl::GLSurface> surface_;
292 scoped_refptr<gl::GLContext> context_; 292 scoped_refptr<gl::GLContext> context_;
293 #if !defined(GPU_FUZZER_USE_ANGLE)
294 std::unique_ptr<gl::GLStubApi> api_;
295 #endif
296 293
297 scoped_refptr<gles2::ShaderTranslatorCache> translator_cache_; 294 scoped_refptr<gles2::ShaderTranslatorCache> translator_cache_;
298 scoped_refptr<gles2::FramebufferCompletenessCache> completeness_cache_; 295 scoped_refptr<gles2::FramebufferCompletenessCache> completeness_cache_;
299 296
300 std::unique_ptr<CommandBufferService> command_buffer_; 297 std::unique_ptr<CommandBufferService> command_buffer_;
301 298
302 std::unique_ptr<gles2::GLES2Decoder> decoder_; 299 std::unique_ptr<gles2::GLES2Decoder> decoder_;
303 std::unique_ptr<CommandExecutor> executor_; 300 std::unique_ptr<CommandExecutor> executor_;
304 301
305 scoped_refptr<gles2::ShaderTranslatorInterface> vertex_translator_; 302 scoped_refptr<gles2::ShaderTranslatorInterface> vertex_translator_;
(...skipping 10 matching lines...) Expand all
316 // registered, causing crashes. 313 // registered, causing crashes.
317 CommandBufferSetup* g_setup = new CommandBufferSetup(); 314 CommandBufferSetup* g_setup = new CommandBufferSetup();
318 315
319 } // anonymous namespace 316 } // anonymous namespace
320 } // namespace gpu 317 } // namespace gpu
321 318
322 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 319 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
323 gpu::g_setup->RunCommandBuffer(data, size); 320 gpu::g_setup->RunCommandBuffer(data, size);
324 return 0; 321 return 0;
325 } 322 }
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_definition.cc ('k') | gpu/config/gpu_info_collector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698