Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| index c0e0e3d7989901dd1718f8f9f588756c2095fa0d..02ad6ed1df55fe865c8a8b0a0dfe677a35a55a67 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -774,6 +774,10 @@ class GLES2DecoderImpl : public GLES2Decoder, |
| return group_->shader_manager(); |
| } |
| + ShaderTranslatorCache* shader_translator_cache() { |
| + return group_->shader_translator_cache(); |
| + } |
| + |
| const TextureManager* texture_manager() const { |
| return group_->texture_manager(); |
| } |
| @@ -2762,9 +2766,10 @@ bool GLES2DecoderImpl::InitializeShaderTranslator() { |
| if (workarounds().unroll_for_loop_with_sampler_array_index) |
| driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX; |
| - ShaderTranslatorCache* cache = ShaderTranslatorCache::GetInstance(); |
| - vertex_translator_ = cache->GetTranslator( |
| - SH_VERTEX_SHADER, shader_spec, &resources, |
| + vertex_translator_ = shader_translator_cache()->GetTranslator( |
| + SH_VERTEX_SHADER, |
| + shader_spec, |
| + &resources, |
| implementation_type, |
| static_cast<ShCompileOptions>(driver_bug_workarounds)); |
| if (!vertex_translator_.get()) { |
| @@ -2773,8 +2778,10 @@ bool GLES2DecoderImpl::InitializeShaderTranslator() { |
| return false; |
| } |
| - fragment_translator_ = cache->GetTranslator( |
| - SH_FRAGMENT_SHADER, shader_spec, &resources, |
| + fragment_translator_ = shader_translator_cache()->GetTranslator( |
| + SH_FRAGMENT_SHADER, |
| + shader_spec, |
| + &resources, |
| implementation_type, |
| static_cast<ShCompileOptions>(driver_bug_workarounds)); |
| if (!fragment_translator_.get()) { |
| @@ -3409,6 +3416,11 @@ void GLES2DecoderImpl::Destroy(bool have_context) { |
| offscreen_resolved_frame_buffer_.reset(); |
| offscreen_resolved_color_texture_.reset(); |
| + // Need to release these before releasing |group_| which may owns the |
|
piman
2014/04/03 05:55:09
nit: "may owns" -> either "owns" or "may own"
|
| + // ShaderTranslatorCache. |
| + fragment_translator_ = NULL; |
| + vertex_translator_ = NULL; |
| + |
| // Should destroy the transfer manager before the texture manager held |
| // by the context group. |
| async_pixel_transfer_manager_.reset(); |