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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc

Issue 2166923002: Add unittests for InvalidateFramebuffer with DEPTH_STENCIL_ATTACHMENT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bots failures Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 3392 matching lines...) Expand 10 before | Expand all | Expand 10 after
3403 GL_COLOR_ATTACHMENT0, 3403 GL_COLOR_ATTACHMENT0,
3404 kServiceTextureId, 4, 5)) 3404 kServiceTextureId, 4, 5))
3405 .Times(1) 3405 .Times(1)
3406 .RetiresOnSaturation(); 3406 .RetiresOnSaturation();
3407 cmds::FramebufferTextureLayer cmd; 3407 cmds::FramebufferTextureLayer cmd;
3408 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, client_texture_id_, 4, 5); 3408 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, client_texture_id_, 4, 5);
3409 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 3409 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3410 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3410 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3411 } 3411 }
3412 3412
3413 TEST_P(GLES3DecoderTest, InvalidateFramebufferDepthStencilAttachment) {
3414 DoBindFramebuffer(
3415 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
3416 DoBindRenderbuffer(
3417 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId);
3418 DoRenderbufferStorage(
3419 GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8,
3420 1, 1, GL_NO_ERROR);
3421 DoFramebufferRenderbuffer(
3422 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
3423 client_renderbuffer_id_, kServiceRenderbufferId, GL_NO_ERROR);
3424
3425 Framebuffer* framebuffer =
3426 group().framebuffer_manager()->GetFramebuffer(client_framebuffer_id_);
3427 // TODO(qiankun.miao@intel.com): We should only make DEPTH and STENCIL
Ken Russell (switch to Gerrit) 2016/07/22 18:24:31 make -> mark?
qiankun 2016/07/22 19:15:06 Done.
3428 // attachments as cleared when command buffer handles DEPTH_STENCIL well.
3429 // http://crbug.com/630568
3430 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr,
3431 GL_DEPTH_ATTACHMENT, true);
3432 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr,
3433 GL_STENCIL_ATTACHMENT, true);
3434 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr,
3435 GL_DEPTH_STENCIL_ATTACHMENT, true);
3436 EXPECT_TRUE(framebuffer->IsCleared());
3437
3438 const GLenum target = GL_FRAMEBUFFER;
3439 const GLsizei count = 1;
3440 GLenum attachments[] = {GL_DEPTH_ATTACHMENT};
3441 EXPECT_CALL(*gl_, InvalidateFramebuffer(target, 0, _))
3442 .Times(1)
3443 .RetiresOnSaturation();
3444 InvalidateFramebufferImmediate& cmd =
3445 *GetImmediateAs<InvalidateFramebufferImmediate>();
3446 cmd.Init(target, count, attachments);
3447
3448 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments)));
3449 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3450 // Invalidating part of DEPTH_STENCIL attachment doesn't change framebuffer
3451 // clearance status.
3452 EXPECT_TRUE(framebuffer->IsCleared());
3453 EXPECT_FALSE(framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT));
3454 EXPECT_FALSE(framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT));
3455 EXPECT_FALSE(framebuffer->HasUnclearedAttachment(
3456 GL_DEPTH_STENCIL_ATTACHMENT));
3457
3458 attachments[0] = GL_DEPTH_STENCIL_ATTACHMENT;
3459 EXPECT_CALL(*gl_, InvalidateFramebuffer(target, 1, _))
3460 .Times(1)
3461 .RetiresOnSaturation();
3462 cmd.Init(target, count, attachments);
3463
3464 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments)));
3465 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3466 // Invalidating DEPTH_STENCIL attachment should make framebuffer uncleared.
3467 EXPECT_FALSE(framebuffer->IsCleared());
3468 EXPECT_TRUE(framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT));
3469 EXPECT_TRUE(framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT));
3470 EXPECT_TRUE(framebuffer->HasUnclearedAttachment(
3471 GL_DEPTH_STENCIL_ATTACHMENT));
3472 }
3473
3413 // TODO(gman): PixelStorei 3474 // TODO(gman): PixelStorei
3414 3475
3415 // TODO(gman): SwapBuffers 3476 // TODO(gman): SwapBuffers
3416 3477
3417 } // namespace gles2 3478 } // namespace gles2
3418 } // namespace gpu 3479 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698