| 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..bf5c04fb8012a2898aba01f6baa2bdc791305ff8 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) \
|
| @@ -7656,7 +7658,7 @@ void GLES2DecoderImpl::DoCopyTexImageIfNeeded(Texture* texture,
|
|
|
| bool GLES2DecoderImpl::PrepareTexturesForRender() {
|
| DCHECK(state_.current_program.get());
|
| - if (!texture_manager()->HaveUnrenderableTextures() &&
|
| + if (!texture_manager()->NeedsTextureRenderChecks() &&
|
| !texture_manager()->HaveImages()) {
|
| return true;
|
| }
|
| @@ -7674,7 +7676,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 +7736,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 +15666,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 nullptr;
|
| +}
|
| +
|
| error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket(
|
| uint32 immediate_data_size,
|
| const void* cmd_data) {
|
|
|