Commit 763f1e25 authored by Khushal's avatar Khushal Committed by Commit Bot

gpu: Fix RasterDecoderContextState ContextState restoration tracking.

We currently make an implict assumption that the caller will restore the
underlying context state in GetContextState, which seems like a brittle
assumption. Make sure we only do it in RestoreState.

R=piman@chromium.org

Change-Id: If436feb21d80ece2181e1af291e078ef59e30736
Reviewed-on: https://chromium-review.googlesource.com/c/1327219
Commit-Queue: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607929}
parent 79fd90c2
...@@ -1031,7 +1031,6 @@ ContextResult RasterDecoderImpl::Initialize( ...@@ -1031,7 +1031,6 @@ ContextResult RasterDecoderImpl::Initialize(
const gles2::ContextState* RasterDecoderImpl::GetContextState() { const gles2::ContextState* RasterDecoderImpl::GetContextState() {
if (raster_decoder_context_state_->need_context_state_reset) { if (raster_decoder_context_state_->need_context_state_reset) {
raster_decoder_context_state_->need_context_state_reset = false;
// Returning nullptr to force full state restoration by the caller. We do // Returning nullptr to force full state restoration by the caller. We do
// this because GrContext changes to GL state are untracked in our state_. // this because GrContext changes to GL state are untracked in our state_.
return nullptr; return nullptr;
...@@ -1192,6 +1191,7 @@ void RasterDecoderImpl::RestoreAllAttributes() const { ...@@ -1192,6 +1191,7 @@ void RasterDecoderImpl::RestoreAllAttributes() const {
void RasterDecoderImpl::RestoreState(const gles2::ContextState* prev_state) { void RasterDecoderImpl::RestoreState(const gles2::ContextState* prev_state) {
TRACE_EVENT1("gpu", "RasterDecoderImpl::RestoreState", "context", TRACE_EVENT1("gpu", "RasterDecoderImpl::RestoreState", "context",
logger_.GetLogPrefix()); logger_.GetLogPrefix());
raster_decoder_context_state_->need_context_state_reset = false;
raster_decoder_context_state_->PessimisticallyResetGrContext(); raster_decoder_context_state_->PessimisticallyResetGrContext();
state_.RestoreState(prev_state); state_.RestoreState(prev_state);
} }
...@@ -1520,7 +1520,6 @@ error::Error RasterDecoderImpl::DoCommandsImpl(unsigned int num_commands, ...@@ -1520,7 +1520,6 @@ error::Error RasterDecoderImpl::DoCommandsImpl(unsigned int num_commands,
} }
if (!PermitsInconsistentContextState(command)) { if (!PermitsInconsistentContextState(command)) {
if (raster_decoder_context_state_->need_context_state_reset) { if (raster_decoder_context_state_->need_context_state_reset) {
raster_decoder_context_state_->need_context_state_reset = false;
RestoreState(nullptr); RestoreState(nullptr);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment