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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 217813004: Make ShaderTranslatorCache thread safe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
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/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 } 767 }
768 768
769 ProgramManager* program_manager() { 769 ProgramManager* program_manager() {
770 return group_->program_manager(); 770 return group_->program_manager();
771 } 771 }
772 772
773 ShaderManager* shader_manager() { 773 ShaderManager* shader_manager() {
774 return group_->shader_manager(); 774 return group_->shader_manager();
775 } 775 }
776 776
777 ShaderTranslatorCache* shader_translator_cache() {
778 return group_->shader_translator_cache();
779 }
780
777 const TextureManager* texture_manager() const { 781 const TextureManager* texture_manager() const {
778 return group_->texture_manager(); 782 return group_->texture_manager();
779 } 783 }
780 784
781 TextureManager* texture_manager() { 785 TextureManager* texture_manager() {
782 return group_->texture_manager(); 786 return group_->texture_manager();
783 } 787 }
784 788
785 MailboxManager* mailbox_manager() { 789 MailboxManager* mailbox_manager() {
786 return group_->mailbox_manager(); 790 return group_->mailbox_manager();
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 driver_bug_workarounds |= SH_EMULATE_BUILT_IN_FUNCTIONS; 2759 driver_bug_workarounds |= SH_EMULATE_BUILT_IN_FUNCTIONS;
2756 if (workarounds().init_gl_position_in_vertex_shader) 2760 if (workarounds().init_gl_position_in_vertex_shader)
2757 driver_bug_workarounds |= SH_INIT_GL_POSITION; 2761 driver_bug_workarounds |= SH_INIT_GL_POSITION;
2758 if (workarounds().unfold_short_circuit_as_ternary_operation) 2762 if (workarounds().unfold_short_circuit_as_ternary_operation)
2759 driver_bug_workarounds |= SH_UNFOLD_SHORT_CIRCUIT; 2763 driver_bug_workarounds |= SH_UNFOLD_SHORT_CIRCUIT;
2760 if (workarounds().init_varyings_without_static_use) 2764 if (workarounds().init_varyings_without_static_use)
2761 driver_bug_workarounds |= SH_INIT_VARYINGS_WITHOUT_STATIC_USE; 2765 driver_bug_workarounds |= SH_INIT_VARYINGS_WITHOUT_STATIC_USE;
2762 if (workarounds().unroll_for_loop_with_sampler_array_index) 2766 if (workarounds().unroll_for_loop_with_sampler_array_index)
2763 driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX; 2767 driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX;
2764 2768
2765 ShaderTranslatorCache* cache = ShaderTranslatorCache::GetInstance(); 2769 vertex_translator_ = shader_translator_cache()->GetTranslator(
2766 vertex_translator_ = cache->GetTranslator( 2770 SH_VERTEX_SHADER,
2767 SH_VERTEX_SHADER, shader_spec, &resources, 2771 shader_spec,
2772 &resources,
2768 implementation_type, 2773 implementation_type,
2769 static_cast<ShCompileOptions>(driver_bug_workarounds)); 2774 static_cast<ShCompileOptions>(driver_bug_workarounds));
2770 if (!vertex_translator_.get()) { 2775 if (!vertex_translator_.get()) {
2771 LOG(ERROR) << "Could not initialize vertex shader translator."; 2776 LOG(ERROR) << "Could not initialize vertex shader translator.";
2772 Destroy(true); 2777 Destroy(true);
2773 return false; 2778 return false;
2774 } 2779 }
2775 2780
2776 fragment_translator_ = cache->GetTranslator( 2781 fragment_translator_ = shader_translator_cache()->GetTranslator(
2777 SH_FRAGMENT_SHADER, shader_spec, &resources, 2782 SH_FRAGMENT_SHADER,
2783 shader_spec,
2784 &resources,
2778 implementation_type, 2785 implementation_type,
2779 static_cast<ShCompileOptions>(driver_bug_workarounds)); 2786 static_cast<ShCompileOptions>(driver_bug_workarounds));
2780 if (!fragment_translator_.get()) { 2787 if (!fragment_translator_.get()) {
2781 LOG(ERROR) << "Could not initialize fragment shader translator."; 2788 LOG(ERROR) << "Could not initialize fragment shader translator.";
2782 Destroy(true); 2789 Destroy(true);
2783 return false; 2790 return false;
2784 } 2791 }
2785 return true; 2792 return true;
2786 } 2793 }
2787 2794
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
3402 offscreen_target_frame_buffer_.reset(); 3409 offscreen_target_frame_buffer_.reset();
3403 offscreen_target_color_texture_.reset(); 3410 offscreen_target_color_texture_.reset();
3404 offscreen_target_color_render_buffer_.reset(); 3411 offscreen_target_color_render_buffer_.reset();
3405 offscreen_target_depth_render_buffer_.reset(); 3412 offscreen_target_depth_render_buffer_.reset();
3406 offscreen_target_stencil_render_buffer_.reset(); 3413 offscreen_target_stencil_render_buffer_.reset();
3407 offscreen_saved_frame_buffer_.reset(); 3414 offscreen_saved_frame_buffer_.reset();
3408 offscreen_saved_color_texture_.reset(); 3415 offscreen_saved_color_texture_.reset();
3409 offscreen_resolved_frame_buffer_.reset(); 3416 offscreen_resolved_frame_buffer_.reset();
3410 offscreen_resolved_color_texture_.reset(); 3417 offscreen_resolved_color_texture_.reset();
3411 3418
3419 // Need to release these before releasing |group_| which may own the
3420 // ShaderTranslatorCache.
3421 fragment_translator_ = NULL;
3422 vertex_translator_ = NULL;
3423
3412 // Should destroy the transfer manager before the texture manager held 3424 // Should destroy the transfer manager before the texture manager held
3413 // by the context group. 3425 // by the context group.
3414 async_pixel_transfer_manager_.reset(); 3426 async_pixel_transfer_manager_.reset();
3415 3427
3416 if (group_.get()) { 3428 if (group_.get()) {
3417 framebuffer_manager()->RemoveObserver(this); 3429 framebuffer_manager()->RemoveObserver(this);
3418 group_->Destroy(this, have_context); 3430 group_->Destroy(this, have_context);
3419 group_ = NULL; 3431 group_ = NULL;
3420 } 3432 }
3421 3433
(...skipping 7256 matching lines...) Expand 10 before | Expand all | Expand 10 after
10678 } 10690 }
10679 } 10691 }
10680 10692
10681 // Include the auto-generated part of this file. We split this because it means 10693 // Include the auto-generated part of this file. We split this because it means
10682 // we can easily edit the non-auto generated parts right here in this file 10694 // we can easily edit the non-auto generated parts right here in this file
10683 // instead of having to edit some template or the code generator. 10695 // instead of having to edit some template or the code generator.
10684 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10696 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10685 10697
10686 } // namespace gles2 10698 } // namespace gles2
10687 } // namespace gpu 10699 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_group_unittest.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698