Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: gpu/command_buffer/service/context_state.cc

Issue 2837213003: Restore samplers' state across virtualized GL contexts. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/gl_state_restorer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/gl_state_restorer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698