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

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

Issue 1583283004: Ensure alpha channel in backbuffer is correct with DirectComposition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 026e2a989eaae7f371e8d67e8713776eac1af494..94a544c34b69ef4e3ce6a490c8fe3b57f01797a1 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1979,6 +1979,8 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
// Backbuffer attachments that are currently undefined.
uint32_t backbuffer_needs_clear_bits_;
+ uint64_t swaps_since_resize_;
+
// The current decoder error communicates the decoder error through command
// processing functions that do not return the error value. Should be set only
// if not returning an error.
@@ -2524,6 +2526,7 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
back_buffer_draw_buffer_(GL_BACK),
surfaceless_(false),
backbuffer_needs_clear_bits_(0),
+ swaps_since_resize_(0),
current_decoder_error_(error::kNoError),
validators_(group_->feature_info()->validators()),
feature_info_(group_->feature_info()),
@@ -3642,8 +3645,7 @@ bool GLES2DecoderImpl::CheckFramebufferValid(
if (surfaceless_)
return false;
if (backbuffer_needs_clear_bits_) {
- glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat(
- offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1.f);
+ glClearColor(0, 0, 0, BackBufferHasAlpha() ? 0 : 1.f);
state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearStencil(0);
state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
@@ -4338,8 +4340,13 @@ error::Error GLES2DecoderImpl::HandleResizeCHROMIUM(
<< "current after resize callback.";
return error::kLostContext;
}
+ if (surface_->BuffersFlipped()) {
+ backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT;
+ }
}
+ swaps_since_resize_ = 0;
+
return error::kNoError;
}
@@ -12193,6 +12200,12 @@ void GLES2DecoderImpl::FinishSwapBuffers(gfx::SwapResult result) {
group_->LoseContexts(error::kUnknown);
}
}
+ ++swaps_since_resize_;
+ if (swaps_since_resize_ == 1 && surface_->BuffersFlipped()) {
+ // The second buffer after a resize is new and needs to be cleared to
+ // known values.
+ backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT;
+ }
}
void GLES2DecoderImpl::DoCommitOverlayPlanes() {
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698