OLD | NEW |
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 3094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3105 state_.vertex_attrib_manager = NULL; | 3105 state_.vertex_attrib_manager = NULL; |
3106 default_vertex_attrib_manager_ = NULL; | 3106 default_vertex_attrib_manager_ = NULL; |
3107 state_.texture_units.clear(); | 3107 state_.texture_units.clear(); |
3108 state_.bound_array_buffer = NULL; | 3108 state_.bound_array_buffer = NULL; |
3109 state_.current_query = NULL; | 3109 state_.current_query = NULL; |
3110 state_.current_program = NULL; | 3110 state_.current_program = NULL; |
3111 state_.bound_read_framebuffer = NULL; | 3111 state_.bound_read_framebuffer = NULL; |
3112 state_.bound_draw_framebuffer = NULL; | 3112 state_.bound_draw_framebuffer = NULL; |
3113 state_.bound_renderbuffer = NULL; | 3113 state_.bound_renderbuffer = NULL; |
3114 | 3114 |
3115 if (offscreen_saved_color_texture_info_) { | 3115 if (offscreen_saved_color_texture_info_.get()) { |
3116 DCHECK(offscreen_target_color_texture_); | 3116 DCHECK(offscreen_target_color_texture_); |
3117 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), | 3117 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), |
3118 offscreen_saved_color_texture_->id()); | 3118 offscreen_saved_color_texture_->id()); |
3119 offscreen_saved_color_texture_->Invalidate(); | 3119 offscreen_saved_color_texture_->Invalidate(); |
3120 offscreen_saved_color_texture_info_ = NULL; | 3120 offscreen_saved_color_texture_info_ = NULL; |
3121 } | 3121 } |
3122 if (have_context) { | 3122 if (have_context) { |
3123 if (copy_texture_CHROMIUM_.get()) { | 3123 if (copy_texture_CHROMIUM_.get()) { |
3124 copy_texture_CHROMIUM_->Destroy(); | 3124 copy_texture_CHROMIUM_->Destroy(); |
3125 copy_texture_CHROMIUM_.reset(); | 3125 copy_texture_CHROMIUM_.reset(); |
(...skipping 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5579 state_.current_program->sampler_indices(); | 5579 state_.current_program->sampler_indices(); |
5580 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { | 5580 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { |
5581 const Program::UniformInfo* uniform_info = | 5581 const Program::UniformInfo* uniform_info = |
5582 state_.current_program->GetUniformInfo(sampler_indices[ii]); | 5582 state_.current_program->GetUniformInfo(sampler_indices[ii]); |
5583 DCHECK(uniform_info); | 5583 DCHECK(uniform_info); |
5584 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { | 5584 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { |
5585 GLuint texture_unit_index = uniform_info->texture_units[jj]; | 5585 GLuint texture_unit_index = uniform_info->texture_units[jj]; |
5586 if (texture_unit_index < state_.texture_units.size()) { | 5586 if (texture_unit_index < state_.texture_units.size()) { |
5587 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; | 5587 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; |
5588 TextureRef* texture = | 5588 TextureRef* texture = |
5589 texture_unit.GetInfoForSamplerType(uniform_info->type); | 5589 texture_unit.GetInfoForSamplerType(uniform_info->type).get(); |
5590 if (!texture || !texture_manager()->CanRender(texture)) { | 5590 if (!texture || !texture_manager()->CanRender(texture)) { |
5591 textures_set = true; | 5591 textures_set = true; |
5592 glActiveTexture(GL_TEXTURE0 + texture_unit_index); | 5592 glActiveTexture(GL_TEXTURE0 + texture_unit_index); |
5593 glBindTexture( | 5593 glBindTexture( |
5594 GetBindTargetForSamplerType(uniform_info->type), | 5594 GetBindTargetForSamplerType(uniform_info->type), |
5595 texture_manager()->black_texture_id(uniform_info->type)); | 5595 texture_manager()->black_texture_id(uniform_info->type)); |
5596 LOCAL_RENDER_WARNING( | 5596 LOCAL_RENDER_WARNING( |
5597 std::string("texture bound to texture unit ") + | 5597 std::string("texture bound to texture unit ") + |
5598 base::IntToString(texture_unit_index) + | 5598 base::IntToString(texture_unit_index) + |
5599 " is not renderable. It maybe non-power-of-2 and have " | 5599 " is not renderable. It maybe non-power-of-2 and have " |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5651 state_.current_program->sampler_indices(); | 5651 state_.current_program->sampler_indices(); |
5652 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { | 5652 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { |
5653 const Program::UniformInfo* uniform_info = | 5653 const Program::UniformInfo* uniform_info = |
5654 state_.current_program->GetUniformInfo(sampler_indices[ii]); | 5654 state_.current_program->GetUniformInfo(sampler_indices[ii]); |
5655 DCHECK(uniform_info); | 5655 DCHECK(uniform_info); |
5656 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { | 5656 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { |
5657 GLuint texture_unit_index = uniform_info->texture_units[jj]; | 5657 GLuint texture_unit_index = uniform_info->texture_units[jj]; |
5658 if (texture_unit_index < state_.texture_units.size()) { | 5658 if (texture_unit_index < state_.texture_units.size()) { |
5659 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; | 5659 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; |
5660 TextureRef* texture_ref = | 5660 TextureRef* texture_ref = |
5661 texture_unit.GetInfoForSamplerType(uniform_info->type); | 5661 texture_unit.GetInfoForSamplerType(uniform_info->type).get(); |
5662 if (texture_ref && !texture_ref->texture()->SafeToRenderFrom()) { | 5662 if (texture_ref && !texture_ref->texture()->SafeToRenderFrom()) { |
5663 if (!texture_manager()->ClearRenderableLevels(this, texture_ref)) { | 5663 if (!texture_manager()->ClearRenderableLevels(this, texture_ref)) { |
5664 return false; | 5664 return false; |
5665 } | 5665 } |
5666 } | 5666 } |
5667 } | 5667 } |
5668 } | 5668 } |
5669 } | 5669 } |
5670 } | 5670 } |
5671 return true; | 5671 return true; |
(...skipping 4648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10320 return error::kNoError; | 10320 return error::kNoError; |
10321 } | 10321 } |
10322 | 10322 |
10323 // Include the auto-generated part of this file. We split this because it means | 10323 // Include the auto-generated part of this file. We split this because it means |
10324 // we can easily edit the non-auto generated parts right here in this file | 10324 // we can easily edit the non-auto generated parts right here in this file |
10325 // instead of having to edit some template or the code generator. | 10325 // instead of having to edit some template or the code generator. |
10326 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10326 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10327 | 10327 |
10328 } // namespace gles2 | 10328 } // namespace gles2 |
10329 } // namespace gpu | 10329 } // namespace gpu |
OLD | NEW |