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

Unified Diff: gpu/command_buffer/tests/fuzzer_main.cc

Issue 2152733003: gpu_fuzzer: cache shader translators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/fuzzer_main.cc
diff --git a/gpu/command_buffer/tests/fuzzer_main.cc b/gpu/command_buffer/tests/fuzzer_main.cc
index 6aa843938ecdffbaec2b39a4523991bb196bf902..519556c57fa8d332dd64ca20ac3832980b8c735c 100644
--- a/gpu/command_buffer/tests/fuzzer_main.cc
+++ b/gpu/command_buffer/tests/fuzzer_main.cc
@@ -114,6 +114,13 @@ class CommandBufferSetup {
CHECK(result);
decoder_->set_max_bucket_size(8 << 20);
context_group->buffer_manager()->set_max_buffer_size(8 << 20);
+ if (!vertex_translator_) {
+ // Keep a reference to the translators, which keeps them in the cache even
+ // after the decoder is reset. They are expensive to initialize, but they
+ // don't keep state.
+ vertex_translator_ = decoder_->GetTranslator(GL_VERTEX_SHADER);
+ fragment_translator_ = decoder_->GetTranslator(GL_FRAGMENT_SHADER);
+ }
}
void ResetDecoder() {
@@ -224,6 +231,9 @@ class CommandBufferSetup {
std::unique_ptr<gles2::GLES2Decoder> decoder_;
std::unique_ptr<CommandExecutor> executor_;
+ scoped_refptr<gles2::ShaderTranslatorInterface> vertex_translator_;
+ scoped_refptr<gles2::ShaderTranslatorInterface> fragment_translator_;
+
scoped_refptr<Buffer> buffer_;
int32_t buffer_id_ = 0;
};
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698