Index: gpu/command_buffer/service/context_state.cc |
diff --git a/gpu/command_buffer/service/context_state.cc b/gpu/command_buffer/service/context_state.cc |
index 5aa24fbacd095e7c09ea022d30254b49588ba9fe..aa5fe7271cc36e702455c666291dc24a690e4e77 100644 |
--- a/gpu/command_buffer/service/context_state.cc |
+++ b/gpu/command_buffer/service/context_state.cc |
@@ -281,6 +281,23 @@ void ContextState::RestoreTextureUnitBindings( |
} |
} |
+void ContextState::RestoreSamplerBinding(GLuint unit, |
+ const ContextState* prev_state) const { |
+ if (!feature_info_->IsES3Capable()) |
+ return; |
+ const scoped_refptr<Sampler>& cur_sampler = sampler_units[unit]; |
+ GLuint cur_id = cur_sampler ? cur_sampler->service_id() : 0; |
+ GLuint prev_id = 0; |
+ if (prev_state) { |
+ const scoped_refptr<Sampler>& prev_sampler = |
+ prev_state->sampler_units[unit]; |
+ prev_id = prev_sampler ? prev_sampler->service_id() : 0; |
+ } |
+ if (!prev_state || cur_id != prev_id) { |
+ glBindSampler(unit, cur_id); |
+ } |
+} |
+ |
void ContextState::PushTextureDecompressionUnpackState() const { |
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
@@ -369,11 +386,12 @@ void ContextState::RestoreActiveTexture() const { |
glActiveTexture(GL_TEXTURE0 + active_texture_unit); |
} |
-void ContextState::RestoreAllTextureUnitBindings( |
+void ContextState::RestoreAllTextureUnitAndSamplerBindings( |
const ContextState* prev_state) const { |
// Restore Texture state. |
for (size_t ii = 0; ii < texture_units.size(); ++ii) { |
RestoreTextureUnitBindings(ii, prev_state); |
+ RestoreSamplerBinding(ii, prev_state); |
} |
RestoreActiveTexture(); |
} |
@@ -496,7 +514,7 @@ void ContextState::RestoreGlobalState(const ContextState* prev_state) const { |
} |
void ContextState::RestoreState(const ContextState* prev_state) { |
- RestoreAllTextureUnitBindings(prev_state); |
+ RestoreAllTextureUnitAndSamplerBindings(prev_state); |
RestoreVertexAttribs(); |
RestoreBufferBindings(); |
RestoreRenderbufferBindings(); |