Chromium Code Reviews| 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..ced07620dd7400d35f3d8235469685263952a3f1 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 (cur_id != prev_id) { |
|
jbauman
2017/04/25 22:47:07
"if (!prev_state || cur_id != prev_id) {"
I think
Ken Russell (switch to Gerrit)
2017/04/26 01:02:25
Thank you for catching this. Done in current patch
|
| + 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(); |