| OLD | NEW |
| 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 26 matching lines...) Expand all Loading... |
| 37 #include "ui/gl/test/gl_surface_test_support.h" | 37 #include "ui/gl/test/gl_surface_test_support.h" |
| 38 | 38 |
| 39 namespace gpu { | 39 namespace gpu { |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 const size_t kCommandBufferSize = 16384; | 42 const size_t kCommandBufferSize = 16384; |
| 43 const size_t kTransferBufferSize = 16384; | 43 const size_t kTransferBufferSize = 16384; |
| 44 const size_t kSmallTransferBufferSize = 16; | 44 const size_t kSmallTransferBufferSize = 16; |
| 45 const size_t kTinyTransferBufferSize = 3; | 45 const size_t kTinyTransferBufferSize = 3; |
| 46 | 46 |
| 47 static const char kExtensions[] = |
| 48 "GL_AMD_compressed_ATC_texture " |
| 49 "GL_ANGLE_texture_compression_dxt3 " |
| 50 "GL_ANGLE_texture_compression_dxt5 " |
| 51 "GL_ANGLE_texture_usage " |
| 52 "GL_APPLE_ycbcr_422 " |
| 53 "GL_ARB_texture_rectangle " |
| 54 "GL_EXT_blend_func_extended " |
| 55 "GL_EXT_color_buffer_float " |
| 56 "GL_EXT_disjoint_timer_query " |
| 57 "GL_EXT_draw_buffers " |
| 58 "GL_EXT_frag_depth " |
| 59 "GL_EXT_multisample_compatibility " |
| 60 "GL_EXT_multisampled_render_to_texture " |
| 61 "GL_EXT_occlusion_query_boolean " |
| 62 "GL_EXT_read_format_bgra " |
| 63 "GL_EXT_shader_texture_lod " |
| 64 "GL_EXT_texture_compression_s3tc " |
| 65 "GL_EXT_texture_filter_anisotropic " |
| 66 "GL_IMG_texture_compression_pvrtc " |
| 67 "GL_KHR_blend_equation_advanced " |
| 68 "GL_KHR_blend_equation_advanced_coherent " |
| 69 "GL_KHR_texture_compression_astc_ldr " |
| 70 "GL_NV_EGL_stream_consumer_external " |
| 71 "GL_NV_framebuffer_mixed_samples " |
| 72 "GL_NV_path_rendering " |
| 73 "GL_OES_compressed_ETC1_RGB8_texture " |
| 74 "GL_OES_depth24 " |
| 75 "GL_OES_EGL_image_external " |
| 76 "GL_OES_rgb8_rgba8 " |
| 77 "GL_OES_texture_float " |
| 78 "GL_OES_texture_float_linear " |
| 79 "GL_OES_texture_half_float " |
| 80 "GL_OES_texture_half_float_linear"; |
| 81 |
| 47 class CommandBufferSetup { | 82 class CommandBufferSetup { |
| 48 public: | 83 public: |
| 49 CommandBufferSetup() | 84 CommandBufferSetup() |
| 50 : atexit_manager_(), | 85 : atexit_manager_(), |
| 51 sync_point_manager_(new SyncPointManager(false)), | 86 sync_point_manager_(new SyncPointManager(false)), |
| 52 sync_point_order_data_(SyncPointOrderData::Create()), | 87 sync_point_order_data_(SyncPointOrderData::Create()), |
| 53 mailbox_manager_(new gles2::MailboxManagerImpl), | 88 mailbox_manager_(new gles2::MailboxManagerImpl), |
| 54 share_group_(new gl::GLShareGroup), | 89 share_group_(new gl::GLShareGroup), |
| 55 surface_(new gl::GLSurfaceStub), | 90 surface_(new gl::GLSurfaceStub), |
| 56 context_(new gl::GLContextStub(share_group_.get())), | 91 context_(new gl::GLContextStub(share_group_.get())), |
| 57 command_buffer_id_(CommandBufferId::FromUnsafeValue(1)) { | 92 command_buffer_id_(CommandBufferId::FromUnsafeValue(1)) { |
| 58 logging::SetMinLogLevel(logging::LOG_FATAL); | 93 logging::SetMinLogLevel(logging::LOG_FATAL); |
| 59 base::CommandLine::Init(0, NULL); | 94 base::CommandLine::Init(0, NULL); |
| 60 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 95 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 61 switches::kEnableUnsafeES3APIs); | 96 switches::kEnableUnsafeES3APIs); |
| 62 gpu_preferences_.enable_unsafe_es3_apis = true; | 97 gpu_preferences_.enable_unsafe_es3_apis = true; |
| 63 | 98 |
| 64 gl::GLSurfaceTestSupport::InitializeOneOffWithMockBindings(); | 99 gl::GLSurfaceTestSupport::InitializeOneOffWithMockBindings(); |
| 100 |
| 101 api_.set_version("OpenGL ES 3.0"); |
| 102 api_.set_extensions(kExtensions); |
| 65 gl::SetStubGLApi(&api_); | 103 gl::SetStubGLApi(&api_); |
| 66 | 104 |
| 67 sync_point_client_ = sync_point_manager_->CreateSyncPointClient( | 105 sync_point_client_ = sync_point_manager_->CreateSyncPointClient( |
| 68 sync_point_order_data_, CommandBufferNamespace::IN_PROCESS, | 106 sync_point_order_data_, CommandBufferNamespace::IN_PROCESS, |
| 69 command_buffer_id_); | 107 command_buffer_id_); |
| 70 | 108 |
| 71 translator_cache_ = new gles2::ShaderTranslatorCache(gpu_preferences_); | 109 translator_cache_ = new gles2::ShaderTranslatorCache(gpu_preferences_); |
| 72 completeness_cache_ = new gles2::FramebufferCompletenessCache; | 110 completeness_cache_ = new gles2::FramebufferCompletenessCache; |
| 73 } | 111 } |
| 74 | 112 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 294 |
| 257 static gpu::CommandBufferSetup& GetSetup() { | 295 static gpu::CommandBufferSetup& GetSetup() { |
| 258 static gpu::CommandBufferSetup setup; | 296 static gpu::CommandBufferSetup setup; |
| 259 return setup; | 297 return setup; |
| 260 } | 298 } |
| 261 | 299 |
| 262 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 300 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 263 GetSetup().RunCommandBuffer(data, size); | 301 GetSetup().RunCommandBuffer(data, size); |
| 264 return 0; | 302 return 0; |
| 265 } | 303 } |
| OLD | NEW |