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

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

Issue 1830453002: WebGL: GL_RGB emulation for IOSurface backed textures. [For reference only] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile error. Created 4 years, 9 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
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 7ecd8d5f47bf07b2f1410eb945e5d1295423c7b6..964aa05990b4b356537e0930c4e3ec6350bdcb52 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -683,6 +683,7 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
// backbuffer if no framebuffer is bound.
// Check with all attached and enabled color attachments.
bool BoundFramebufferHasColorAttachmentWithAlpha();
+ bool BoundFramebufferEmulatingRGB();
bool BoundFramebufferHasDepthAttachment();
bool BoundFramebufferHasStencilAttachment();
@@ -4710,6 +4711,14 @@ bool GLES2DecoderImpl::BoundFramebufferHasColorAttachmentWithAlpha() {
return BackBufferHasAlpha();
}
+bool GLES2DecoderImpl::BoundFramebufferEmulatingRGB() {
+ Framebuffer* framebuffer =
+ GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
+ if (framebuffer)
+ return framebuffer->EmulatingRGB();
+ return false;
+}
+
bool GLES2DecoderImpl::BoundFramebufferHasDepthAttachment() {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
@@ -4736,6 +4745,20 @@ bool GLES2DecoderImpl::BoundFramebufferHasStencilAttachment() {
}
void GLES2DecoderImpl::ApplyDirtyState() {
+ if (BoundFramebufferEmulatingRGB()) {
+ Framebuffer* framebuffer =
+ GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
+ if (framebuffer->HasUninitializedDrawBuffers()) {
+ glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
+ state_.SetDeviceColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glClearColor(state_.color_clear_red, state_.color_clear_green,
+ state_.color_clear_blue, state_.color_clear_alpha);
+ framebuffer->SetDrawBuffersAsInitialized();
+ framebuffer_state_.clear_state_dirty = true;
+ }
+ }
+
if (framebuffer_state_.clear_state_dirty) {
bool have_alpha = BoundFramebufferHasColorAttachmentWithAlpha();
state_.SetDeviceColorMask(state_.color_mask_red,
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698