| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 if (!vertex_translator_) { | 183 if (!vertex_translator_) { |
| 184 // Keep a reference to the translators, which keeps them in the cache even | 184 // Keep a reference to the translators, which keeps them in the cache even |
| 185 // after the decoder is reset. They are expensive to initialize, but they | 185 // after the decoder is reset. They are expensive to initialize, but they |
| 186 // don't keep state. | 186 // don't keep state. |
| 187 vertex_translator_ = decoder_->GetTranslator(GL_VERTEX_SHADER); | 187 vertex_translator_ = decoder_->GetTranslator(GL_VERTEX_SHADER); |
| 188 fragment_translator_ = decoder_->GetTranslator(GL_FRAGMENT_SHADER); | 188 fragment_translator_ = decoder_->GetTranslator(GL_FRAGMENT_SHADER); |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 void ResetDecoder() { | 192 void ResetDecoder() { |
| 193 decoder_->Destroy(true); |
| 194 decoder_.reset(); |
| 193 if (recreate_context_) { | 195 if (recreate_context_) { |
| 194 context_->ReleaseCurrent(nullptr); | 196 context_->ReleaseCurrent(nullptr); |
| 195 context_ = nullptr; | 197 context_ = nullptr; |
| 196 } | 198 } |
| 197 decoder_->Destroy(true); | |
| 198 decoder_.reset(); | |
| 199 command_buffer_.reset(); | 199 command_buffer_.reset(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 ~CommandBufferSetup() { | 202 ~CommandBufferSetup() { |
| 203 if (sync_point_order_data_) { | 203 if (sync_point_order_data_) { |
| 204 sync_point_order_data_->Destroy(); | 204 sync_point_order_data_->Destroy(); |
| 205 sync_point_order_data_ = nullptr; | 205 sync_point_order_data_ = nullptr; |
| 206 } | 206 } |
| 207 if (sync_point_client_state_) { | 207 if (sync_point_client_state_) { |
| 208 sync_point_client_state_->Destroy(); | 208 sync_point_client_state_->Destroy(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // registered, causing crashes. | 336 // registered, causing crashes. |
| 337 CommandBufferSetup* g_setup = new CommandBufferSetup(); | 337 CommandBufferSetup* g_setup = new CommandBufferSetup(); |
| 338 | 338 |
| 339 } // anonymous namespace | 339 } // anonymous namespace |
| 340 } // namespace gpu | 340 } // namespace gpu |
| 341 | 341 |
| 342 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 342 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 343 gpu::g_setup->RunCommandBuffer(data, size); | 343 gpu::g_setup->RunCommandBuffer(data, size); |
| 344 return 0; | 344 return 0; |
| 345 } | 345 } |
| OLD | NEW |