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 e8bbe5885459434f3dff96c195f981ae1b6ee30d..cd91cddc10bc446778ea3495a525d0d3642f1990 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -1910,6 +1910,8 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
| GLint location, |
| const std::string& name); |
| + const SamplerState& GetSamplerStateForTextureUnit(GLenum target, GLuint unit); |
| + |
| // Generate a member function prototype for each command in an automated and |
| // typesafe way. |
| #define GLES2_CMD_OP(name) \ |
| @@ -2110,6 +2112,8 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
| GLfloat line_width_range_[2]; |
| + SamplerState default_sampler_state_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); |
| }; |
| @@ -7656,8 +7660,7 @@ void GLES2DecoderImpl::DoCopyTexImageIfNeeded(Texture* texture, |
| bool GLES2DecoderImpl::PrepareTexturesForRender() { |
| DCHECK(state_.current_program.get()); |
| - if (!texture_manager()->HaveUnrenderableTextures() && |
| - !texture_manager()->HaveImages()) { |
| + if (!texture_manager()->HaveImages()) { |
|
Zhenyao Mo
2015/12/14 22:48:33
This is wrong. Now we can't short cut here as we
Ken Russell (switch to Gerrit)
2015/12/14 23:22:44
Could this be updated so that at least ES 2.0 cont
Zhenyao Mo
2015/12/14 23:58:17
Now that we could possibly share textures among ES
Ken Russell (switch to Gerrit)
2015/12/15 00:27:20
It's a good point. As long as these checks are onl
|
| return true; |
| } |
| bool textures_set = false; |
| @@ -7674,7 +7677,11 @@ bool GLES2DecoderImpl::PrepareTexturesForRender() { |
| TextureRef* texture_ref = |
| texture_unit.GetInfoForSamplerType(uniform_info->type).get(); |
| GLenum textarget = GetBindTargetForSamplerType(uniform_info->type); |
| - if (!texture_ref || !texture_manager()->CanRender(texture_ref)) { |
| + const SamplerState& sampler_state = GetSamplerStateForTextureUnit( |
| + uniform_info->type, texture_unit_index); |
| + if (!texture_ref || |
| + !texture_manager()->CanRenderWithSampler( |
| + texture_ref, sampler_state)) { |
| textures_set = true; |
| glActiveTexture(GL_TEXTURE0 + texture_unit_index); |
| glBindTexture( |
| @@ -7730,7 +7737,11 @@ void GLES2DecoderImpl::RestoreStateForTextures() { |
| TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; |
| TextureRef* texture_ref = |
| texture_unit.GetInfoForSamplerType(uniform_info->type).get(); |
| - if (!texture_ref || !texture_manager()->CanRender(texture_ref)) { |
| + const SamplerState& sampler_state = GetSamplerStateForTextureUnit( |
| + uniform_info->type, texture_unit_index); |
| + if (!texture_ref || |
| + !texture_manager()->CanRenderWithSampler( |
| + texture_ref, sampler_state)) { |
| glActiveTexture(GL_TEXTURE0 + texture_unit_index); |
| // Get the texture_ref info that was previously bound here. |
| texture_ref = texture_unit.bind_target == GL_TEXTURE_2D |
| @@ -15656,6 +15667,21 @@ void GLES2DecoderImpl::DoBindFragmentInputLocationCHROMIUM( |
| program->SetFragmentInputLocationBinding(name, location); |
| } |
| +const SamplerState& GLES2DecoderImpl::GetSamplerStateForTextureUnit( |
| + GLenum target, GLuint unit) { |
| + if (features().enable_samplers) { |
| + Sampler* sampler = state_.sampler_units[unit].get(); |
| + if (sampler) |
| + return sampler->sampler_state(); |
| + } |
| + TextureUnit& texture_unit = state_.texture_units[unit]; |
| + TextureRef* texture_ref = texture_unit.GetInfoForSamplerType(target).get(); |
| + if (texture_ref) |
| + return texture_ref->texture()->sampler_state(); |
| + |
| + return default_sampler_state_; |
| +} |
| + |
| error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket( |
| uint32 immediate_data_size, |
| const void* cmd_data) { |