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

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

Issue 2612523003: [WIP] Remove unnecessary clear_state_dirty
Patch Set: code rebase Created 3 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 | « gpu/command_buffer/service/context_state.h ('k') | no next file » | 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 3c2f69440091f8020df96bec44979fa8f6892b18..4363b515033158e73d55a3af1c52a8220e509070 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -4049,7 +4049,7 @@ void GLES2DecoderImpl::DeleteFramebuffersHelper(
glBindFramebufferEXT(target, GetBackbufferServiceId());
framebuffer_state_.bound_draw_framebuffer = NULL;
- framebuffer_state_.clear_state_dirty = true;
+ // framebuffer_state_.clear_state_dirty = true;
}
if (framebuffer == framebuffer_state_.bound_read_framebuffer.get()) {
framebuffer_state_.bound_read_framebuffer = NULL;
@@ -4090,7 +4090,7 @@ void GLES2DecoderImpl::DeleteRenderbuffersHelper(
->UnbindRenderbuffer(GL_FRAMEBUFFER, renderbuffer);
}
}
- framebuffer_state_.clear_state_dirty = true;
+ // framebuffer_state_.clear_state_dirty = true;
RemoveRenderbuffer(client_id);
}
}
@@ -4105,7 +4105,7 @@ void GLES2DecoderImpl::DeleteTexturesHelper(GLsizei n,
if (texture_ref) {
Texture* texture = texture_ref->texture();
if (texture->IsAttachedToFramebuffer()) {
- framebuffer_state_.clear_state_dirty = true;
+ // framebuffer_state_.clear_state_dirty = true;
}
// Unbind texture_ref from texture_ref units.
state_.UnbindTexture(texture_ref);
@@ -4238,7 +4238,7 @@ static void RebindCurrentFramebuffer(
}
void GLES2DecoderImpl::RestoreCurrentFramebufferBindings() {
- framebuffer_state_.clear_state_dirty = true;
+ // framebuffer_state_.clear_state_dirty = true;
if (!SupportsSeparateFramebufferBinds()) {
RebindCurrentFramebuffer(
@@ -5488,8 +5488,9 @@ bool GLES2DecoderImpl::BoundFramebufferHasStencilAttachment() {
return back_buffer_has_stencil_;
}
-void GLES2DecoderImpl::ApplyDirtyState() {
+/* void GLES2DecoderImpl::ApplyDirtyState() {
if (framebuffer_state_.clear_state_dirty) {
+ // print("**** enter ApplyDirtyState ****\n");
bool allows_alpha_change = BoundFramebufferAllowsChangesToAlphaChannel();
state_.SetDeviceColorMask(state_.color_mask_red, state_.color_mask_green,
state_.color_mask_blue,
@@ -5511,6 +5512,37 @@ void GLES2DecoderImpl::ApplyDirtyState() {
framebuffer_state_.clear_state_dirty = false;
}
}
+*/
+void GLES2DecoderImpl::ApplyDirtyState() {
+ if (framebuffer_state_.clear_state_dirty) {
+ // print("**** enter ApplyDirtyState ****\n");
+ // bool allows_alpha_change = BoundFramebufferAllowsChangesToAlphaChannel();
+ state_.SetDeviceColorMask(state_.color_mask_red, state_.color_mask_green,
+ state_.color_mask_blue,
+ // state_.color_mask_alpha && allows_alpha_change);
+ state_.color_mask_alpha);
+
+ // bool have_depth = BoundFramebufferHasDepthAttachment();
+ // state_.SetDeviceDepthMask(state_.depth_mask && have_depth);
+ state_.SetDeviceDepthMask(state_.depth_mask);
+
+ // bool have_stencil = BoundFramebufferHasStencilAttachment();
+ state_.SetDeviceStencilMaskSeparate(
+ // GL_FRONT, have_stencil ? state_.stencil_front_writemask : 0);
+ GL_FRONT, state_.stencil_front_writemask);
+ state_.SetDeviceStencilMaskSeparate(
+ // GL_BACK, have_stencil ? state_.stencil_back_writemask : 0);
+ GL_BACK, state_.stencil_back_writemask);
+
+ state_.SetDeviceCapabilityState(
+ // GL_DEPTH_TEST, state_.enable_flags.depth_test && have_depth);
+ GL_DEPTH_TEST, state_.enable_flags.depth_test);
+ state_.SetDeviceCapabilityState(
+ // GL_STENCIL_TEST, state_.enable_flags.stencil_test && have_stencil);
+ GL_STENCIL_TEST, state_.enable_flags.stencil_test);
+ framebuffer_state_.clear_state_dirty = false;
+ }
+}
GLuint GLES2DecoderImpl::GetBackbufferServiceId() const {
return (offscreen_target_frame_buffer_.get())
@@ -5653,7 +5685,7 @@ void GLES2DecoderImpl::DoBindFramebuffer(GLenum target, GLuint client_id) {
framebuffer_state_.bound_read_framebuffer = framebuffer;
}
- framebuffer_state_.clear_state_dirty = true;
+ // framebuffer_state_.clear_state_dirty = true;
// If we are rendering to the backbuffer get the FBO id for any simulated
// backbuffer.
@@ -7446,7 +7478,7 @@ void GLES2DecoderImpl::DoFramebufferRenderbuffer(
}
}
if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) {
- framebuffer_state_.clear_state_dirty = true;
+ // framebuffer_state_.clear_state_dirty = true;
}
OnFboChanged();
}
@@ -7700,7 +7732,7 @@ void GLES2DecoderImpl::DoFramebufferTexture2DCommon(
}
}
if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) {
- framebuffer_state_.clear_state_dirty = true;
+ // framebuffer_state_.clear_state_dirty = true;
}
OnFboChanged();
@@ -7757,7 +7789,7 @@ void GLES2DecoderImpl::DoFramebufferTextureLayer(
attachment, texture_ref, texture_target, level, layer);
}
if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) {
- framebuffer_state_.clear_state_dirty = true;
+ // framebuffer_state_.clear_state_dirty = true;
}
}
@@ -9593,6 +9625,7 @@ void GLES2DecoderImpl::RestoreStateForTextures() {
}
bool GLES2DecoderImpl::ClearUnclearedTextures() {
+ // print("**** enter ClearUnclearedTextures ****\n");
// Only check if there are some uncleared textures.
if (!texture_manager()->HaveUnsafeTextures()) {
return true;
@@ -9621,6 +9654,7 @@ bool GLES2DecoderImpl::ClearUnclearedTextures() {
}
}
}
+ // RestoreClearState();
return true;
}
@@ -10159,6 +10193,7 @@ error::Error GLES2DecoderImpl::DoDrawElements(const char* function_name,
function_name, max_vertex_accessed, &simulated_fixed_attribs,
primcount)) {
bool textures_set = !PrepareTexturesForRender();
+ // print("#### may enter ApplyDirtyState ****\n");
ApplyDirtyState();
// TODO(gman): Refactor to hide these details in BufferManager or
// VertexAttribManager.
@@ -10178,6 +10213,7 @@ error::Error GLES2DecoderImpl::DoDrawElements(const char* function_name,
glEnable(GL_PRIMITIVE_RESTART);
buffer_manager()->SetPrimitiveRestartFixedIndexIfNecessary(type);
}
+ // RestoreClearState();
if (!instanced) {
glDrawElements(mode, count, type, indices);
} else {
@@ -13471,7 +13507,7 @@ error::Error GLES2DecoderImpl::DoCompressedTexImage(
}
if (texture->IsAttachedToFramebuffer()) {
- framebuffer_state_.clear_state_dirty = true;
+ // framebuffer_state_.clear_state_dirty = true;
}
std::unique_ptr<int8_t[]> zero;
@@ -14078,7 +14114,7 @@ void GLES2DecoderImpl::DoCopyTexImage2D(
gfx::Size size = GetBoundReadFramebufferSize();
if (texture->IsAttachedToFramebuffer()) {
- framebuffer_state_.clear_state_dirty = true;
+ // framebuffer_state_.clear_state_dirty = true;
}
bool requires_luma_blit =
@@ -16910,7 +16946,7 @@ void GLES2DecoderImpl::TexStorageImpl(GLenum target,
}
Texture* texture = texture_ref->texture();
if (texture->IsAttachedToFramebuffer()) {
- framebuffer_state_.clear_state_dirty = true;
+ // framebuffer_state_.clear_state_dirty = true;
}
if (texture->IsImmutable()) {
LOCAL_SET_GL_ERROR(
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698