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 f7073dbddb41c6b853c87753ca411b949433ca5d..fd0756ebdc12e81a6b560ca4e44f7d4b82f8ffe5 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -1881,6 +1881,8 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
// will rebind all external textures to match their current service_id. |
void RestoreAllExternalTextureBindingsIfNeeded() override; |
+ 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) \ |
@@ -2087,6 +2089,8 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
GLfloat line_width_range_[2]; |
+ SamplerState default_sampler_state_; |
+ |
DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); |
}; |
@@ -7605,10 +7609,6 @@ void GLES2DecoderImpl::DoCopyTexImageIfNeeded(Texture* texture, |
bool GLES2DecoderImpl::PrepareTexturesForRender() { |
DCHECK(state_.current_program.get()); |
- if (!texture_manager()->HaveUnrenderableTextures() && |
- !texture_manager()->HaveImages()) { |
- return true; |
- } |
bool textures_set = false; |
const Program::SamplerIndices& sampler_indices = |
state_.current_program->sampler_indices(); |
@@ -7623,7 +7623,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( |
@@ -7679,7 +7683,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 = |
@@ -15420,6 +15428,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_t immediate_data_size, |
const void* cmd_data) { |