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 <cmath> | 10 #include <cmath> |
(...skipping 6924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6935 const Program::UniformInfo* uniform_info = | 6935 const Program::UniformInfo* uniform_info = |
6936 state_.current_program->GetUniformInfo(sampler_indices[ii]); | 6936 state_.current_program->GetUniformInfo(sampler_indices[ii]); |
6937 DCHECK(uniform_info); | 6937 DCHECK(uniform_info); |
6938 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { | 6938 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { |
6939 GLuint texture_unit_index = uniform_info->texture_units[jj]; | 6939 GLuint texture_unit_index = uniform_info->texture_units[jj]; |
6940 if (texture_unit_index < state_.texture_units.size()) { | 6940 if (texture_unit_index < state_.texture_units.size()) { |
6941 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; | 6941 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; |
6942 TextureRef* texture_ref = | 6942 TextureRef* texture_ref = |
6943 texture_unit.GetInfoForSamplerType(uniform_info->type).get(); | 6943 texture_unit.GetInfoForSamplerType(uniform_info->type).get(); |
6944 GLenum textarget = GetBindTargetForSamplerType(uniform_info->type); | 6944 GLenum textarget = GetBindTargetForSamplerType(uniform_info->type); |
6945 if (!texture_ref || !texture_manager()->CanRender(texture_ref)) { | 6945 if (!texture_ref || |
| 6946 !texture_manager()->IsTextureComplete(texture_ref)) { |
6946 textures_set = true; | 6947 textures_set = true; |
6947 glActiveTexture(GL_TEXTURE0 + texture_unit_index); | 6948 glActiveTexture(GL_TEXTURE0 + texture_unit_index); |
6948 glBindTexture( | 6949 glBindTexture( |
6949 textarget, | 6950 textarget, |
6950 texture_manager()->black_texture_id(uniform_info->type)); | 6951 texture_manager()->black_texture_id(uniform_info->type)); |
6951 if (!texture_ref) { | 6952 if (!texture_ref) { |
6952 LOCAL_RENDER_WARNING( | 6953 LOCAL_RENDER_WARNING( |
6953 std::string("there is no texture bound to the unit ") + | 6954 std::string("there is no texture bound to the unit ") + |
6954 base::IntToString(texture_unit_index)); | 6955 base::IntToString(texture_unit_index)); |
6955 } else { | 6956 } else { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6988 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { | 6989 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { |
6989 const Program::UniformInfo* uniform_info = | 6990 const Program::UniformInfo* uniform_info = |
6990 state_.current_program->GetUniformInfo(sampler_indices[ii]); | 6991 state_.current_program->GetUniformInfo(sampler_indices[ii]); |
6991 DCHECK(uniform_info); | 6992 DCHECK(uniform_info); |
6992 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { | 6993 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { |
6993 GLuint texture_unit_index = uniform_info->texture_units[jj]; | 6994 GLuint texture_unit_index = uniform_info->texture_units[jj]; |
6994 if (texture_unit_index < state_.texture_units.size()) { | 6995 if (texture_unit_index < state_.texture_units.size()) { |
6995 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; | 6996 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; |
6996 TextureRef* texture_ref = | 6997 TextureRef* texture_ref = |
6997 texture_unit.GetInfoForSamplerType(uniform_info->type).get(); | 6998 texture_unit.GetInfoForSamplerType(uniform_info->type).get(); |
6998 if (!texture_ref || !texture_manager()->CanRender(texture_ref)) { | 6999 if (!texture_ref || |
| 7000 !texture_manager()->IsTextureComplete(texture_ref)) { |
6999 glActiveTexture(GL_TEXTURE0 + texture_unit_index); | 7001 glActiveTexture(GL_TEXTURE0 + texture_unit_index); |
7000 // Get the texture_ref info that was previously bound here. | 7002 // Get the texture_ref info that was previously bound here. |
7001 texture_ref = texture_unit.bind_target == GL_TEXTURE_2D | 7003 texture_ref = texture_unit.bind_target == GL_TEXTURE_2D |
7002 ? texture_unit.bound_texture_2d.get() | 7004 ? texture_unit.bound_texture_2d.get() |
7003 : texture_unit.bound_texture_cube_map.get(); | 7005 : texture_unit.bound_texture_cube_map.get(); |
7004 glBindTexture(texture_unit.bind_target, | 7006 glBindTexture(texture_unit.bind_target, |
7005 texture_ref ? texture_ref->service_id() : 0); | 7007 texture_ref ? texture_ref->service_id() : 0); |
7006 continue; | 7008 continue; |
7007 } | 7009 } |
7008 | 7010 |
(...skipping 7536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14545 return error::kNoError; | 14547 return error::kNoError; |
14546 } | 14548 } |
14547 | 14549 |
14548 // Include the auto-generated part of this file. We split this because it means | 14550 // Include the auto-generated part of this file. We split this because it means |
14549 // we can easily edit the non-auto generated parts right here in this file | 14551 // we can easily edit the non-auto generated parts right here in this file |
14550 // instead of having to edit some template or the code generator. | 14552 // instead of having to edit some template or the code generator. |
14551 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 14553 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
14552 | 14554 |
14553 } // namespace gles2 | 14555 } // namespace gles2 |
14554 } // namespace gpu | 14556 } // namespace gpu |
OLD | NEW |