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

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

Issue 1168213003: gpu: Make sure we restore scissor rect after clearing a texture level. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enable scissor test in UnClearedAttachmentsGetClearedOnClear Created 5 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_unittest_base.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 683
684 void GLES2DecoderTestBase::SetupExpectationsForFramebufferClearing( 684 void GLES2DecoderTestBase::SetupExpectationsForFramebufferClearing(
685 GLenum target, 685 GLenum target,
686 GLuint clear_bits, 686 GLuint clear_bits,
687 GLclampf restore_red, 687 GLclampf restore_red,
688 GLclampf restore_green, 688 GLclampf restore_green,
689 GLclampf restore_blue, 689 GLclampf restore_blue,
690 GLclampf restore_alpha, 690 GLclampf restore_alpha,
691 GLuint restore_stencil, 691 GLuint restore_stencil,
692 GLclampf restore_depth, 692 GLclampf restore_depth,
693 bool restore_scissor_test) { 693 bool restore_scissor_test,
694 GLint restore_scissor_x,
695 GLint restore_scissor_y,
696 GLsizei restore_scissor_width,
697 GLsizei restore_scissor_height) {
694 SetupExpectationsForFramebufferClearingMulti( 698 SetupExpectationsForFramebufferClearingMulti(
695 0, 699 0, 0, target, clear_bits, restore_red, restore_green, restore_blue,
696 0, 700 restore_alpha, restore_stencil, restore_depth, restore_scissor_test,
697 target, 701 restore_scissor_x, restore_scissor_y, restore_scissor_width,
698 clear_bits, 702 restore_scissor_height);
699 restore_red,
700 restore_green,
701 restore_blue,
702 restore_alpha,
703 restore_stencil,
704 restore_depth,
705 restore_scissor_test);
706 } 703 }
707 704
708 void GLES2DecoderTestBase::SetupExpectationsForRestoreClearState( 705 void GLES2DecoderTestBase::SetupExpectationsForRestoreClearState(
709 GLclampf restore_red, 706 GLclampf restore_red,
710 GLclampf restore_green, 707 GLclampf restore_green,
711 GLclampf restore_blue, 708 GLclampf restore_blue,
712 GLclampf restore_alpha, 709 GLclampf restore_alpha,
713 GLuint restore_stencil, 710 GLuint restore_stencil,
714 GLclampf restore_depth, 711 GLclampf restore_depth,
715 bool restore_scissor_test) { 712 bool restore_scissor_test,
713 GLint restore_scissor_x,
714 GLint restore_scissor_y,
715 GLsizei restore_scissor_width,
716 GLsizei restore_scissor_height) {
716 EXPECT_CALL(*gl_, ClearColor( 717 EXPECT_CALL(*gl_, ClearColor(
717 restore_red, restore_green, restore_blue, restore_alpha)) 718 restore_red, restore_green, restore_blue, restore_alpha))
718 .Times(1) 719 .Times(1)
719 .RetiresOnSaturation(); 720 .RetiresOnSaturation();
720 EXPECT_CALL(*gl_, ClearStencil(restore_stencil)) 721 EXPECT_CALL(*gl_, ClearStencil(restore_stencil))
721 .Times(1) 722 .Times(1)
722 .RetiresOnSaturation(); 723 .RetiresOnSaturation();
723 EXPECT_CALL(*gl_, ClearDepth(restore_depth)) 724 EXPECT_CALL(*gl_, ClearDepth(restore_depth))
724 .Times(1) 725 .Times(1)
725 .RetiresOnSaturation(); 726 .RetiresOnSaturation();
726 if (restore_scissor_test) { 727 SetupExpectationsForEnableDisable(GL_SCISSOR_TEST, restore_scissor_test);
727 EXPECT_CALL(*gl_, Enable(GL_SCISSOR_TEST)) 728 EXPECT_CALL(*gl_, Scissor(restore_scissor_x, restore_scissor_y,
728 .Times(1) 729 restore_scissor_width, restore_scissor_height))
729 .RetiresOnSaturation(); 730 .Times(1)
730 } 731 .RetiresOnSaturation();
731 } 732 }
732 733
733 void GLES2DecoderTestBase::SetupExpectationsForFramebufferClearingMulti( 734 void GLES2DecoderTestBase::SetupExpectationsForFramebufferClearingMulti(
734 GLuint read_framebuffer_service_id, 735 GLuint read_framebuffer_service_id,
735 GLuint draw_framebuffer_service_id, 736 GLuint draw_framebuffer_service_id,
736 GLenum target, 737 GLenum target,
737 GLuint clear_bits, 738 GLuint clear_bits,
738 GLclampf restore_red, 739 GLclampf restore_red,
739 GLclampf restore_green, 740 GLclampf restore_green,
740 GLclampf restore_blue, 741 GLclampf restore_blue,
741 GLclampf restore_alpha, 742 GLclampf restore_alpha,
742 GLuint restore_stencil, 743 GLuint restore_stencil,
743 GLclampf restore_depth, 744 GLclampf restore_depth,
744 bool restore_scissor_test) { 745 bool restore_scissor_test,
746 GLint restore_scissor_x,
747 GLint restore_scissor_y,
748 GLsizei restore_scissor_width,
749 GLsizei restore_scissor_height) {
745 // TODO(gman): Figure out why InSequence stopped working. 750 // TODO(gman): Figure out why InSequence stopped working.
746 // InSequence sequence; 751 // InSequence sequence;
747 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(target)) 752 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(target))
748 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 753 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
749 .RetiresOnSaturation(); 754 .RetiresOnSaturation();
750 if (target == GL_READ_FRAMEBUFFER_EXT) { 755 if (target == GL_READ_FRAMEBUFFER_EXT) {
751 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0)) 756 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0))
752 .Times(1) 757 .Times(1)
753 .RetiresOnSaturation(); 758 .RetiresOnSaturation();
754 EXPECT_CALL(*gl_, BindFramebufferEXT( 759 EXPECT_CALL(*gl_, BindFramebufferEXT(
(...skipping 19 matching lines...) Expand all
774 EXPECT_CALL(*gl_, ClearDepth(1.0f)) 779 EXPECT_CALL(*gl_, ClearDepth(1.0f))
775 .Times(1) 780 .Times(1)
776 .RetiresOnSaturation(); 781 .RetiresOnSaturation();
777 SetupExpectationsForDepthMask(true); 782 SetupExpectationsForDepthMask(true);
778 } 783 }
779 SetupExpectationsForEnableDisable(GL_SCISSOR_TEST, false); 784 SetupExpectationsForEnableDisable(GL_SCISSOR_TEST, false);
780 EXPECT_CALL(*gl_, Clear(clear_bits)) 785 EXPECT_CALL(*gl_, Clear(clear_bits))
781 .Times(1) 786 .Times(1)
782 .RetiresOnSaturation(); 787 .RetiresOnSaturation();
783 SetupExpectationsForRestoreClearState( 788 SetupExpectationsForRestoreClearState(
784 restore_red, restore_green, restore_blue, restore_alpha, 789 restore_red, restore_green, restore_blue, restore_alpha, restore_stencil,
785 restore_stencil, restore_depth, restore_scissor_test); 790 restore_depth, restore_scissor_test, restore_scissor_x, restore_scissor_y,
791 restore_scissor_width, restore_scissor_height);
786 if (target == GL_READ_FRAMEBUFFER_EXT) { 792 if (target == GL_READ_FRAMEBUFFER_EXT) {
787 EXPECT_CALL(*gl_, BindFramebufferEXT( 793 EXPECT_CALL(*gl_, BindFramebufferEXT(
788 GL_READ_FRAMEBUFFER_EXT, read_framebuffer_service_id)) 794 GL_READ_FRAMEBUFFER_EXT, read_framebuffer_service_id))
789 .Times(1) 795 .Times(1)
790 .RetiresOnSaturation(); 796 .RetiresOnSaturation();
791 EXPECT_CALL(*gl_, BindFramebufferEXT( 797 EXPECT_CALL(*gl_, BindFramebufferEXT(
792 GL_DRAW_FRAMEBUFFER_EXT, draw_framebuffer_service_id)) 798 GL_DRAW_FRAMEBUFFER_EXT, draw_framebuffer_service_id))
793 .Times(1) 799 .Times(1)
794 .RetiresOnSaturation(); 800 .RetiresOnSaturation();
795 } 801 }
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 EXPECT_CALL(*gl_, BufferSubData(target, offset, size, 1673 EXPECT_CALL(*gl_, BufferSubData(target, offset, size,
1668 shared_memory_address_)) 1674 shared_memory_address_))
1669 .Times(1) 1675 .Times(1)
1670 .RetiresOnSaturation(); 1676 .RetiresOnSaturation();
1671 memcpy(shared_memory_address_, data, size); 1677 memcpy(shared_memory_address_, data, size);
1672 cmds::BufferSubData cmd; 1678 cmds::BufferSubData cmd;
1673 cmd.Init(target, offset, size, shared_memory_id_, shared_memory_offset_); 1679 cmd.Init(target, offset, size, shared_memory_id_, shared_memory_offset_);
1674 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1680 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1675 } 1681 }
1676 1682
1683 void GLES2DecoderTestBase::DoScissor(GLint x,
1684 GLint y,
1685 GLsizei width,
1686 GLsizei height) {
1687 EXPECT_CALL(*gl_, Scissor(x, y, width, height))
1688 .Times(1)
1689 .RetiresOnSaturation();
1690 cmds::Scissor cmd;
1691 cmd.Init(x, y, width, height);
1692 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1693 }
1694
1677 void GLES2DecoderTestBase::SetupVertexBuffer() { 1695 void GLES2DecoderTestBase::SetupVertexBuffer() {
1678 DoEnableVertexAttribArray(1); 1696 DoEnableVertexAttribArray(1);
1679 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId); 1697 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId);
1680 DoBufferData(GL_ARRAY_BUFFER, kNumVertices * 2 * sizeof(GLfloat)); 1698 DoBufferData(GL_ARRAY_BUFFER, kNumVertices * 2 * sizeof(GLfloat));
1681 } 1699 }
1682 1700
1683 void GLES2DecoderTestBase::SetupAllNeededVertexBuffers() { 1701 void GLES2DecoderTestBase::SetupAllNeededVertexBuffers() {
1684 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId); 1702 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId);
1685 DoBufferData(GL_ARRAY_BUFFER, kNumVertices * 16 * sizeof(float)); 1703 DoBufferData(GL_ARRAY_BUFFER, kNumVertices * 16 * sizeof(float));
1686 DoEnableVertexAttribArray(0); 1704 DoEnableVertexAttribArray(0);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 SetupDefaultProgram(); 1834 SetupDefaultProgram();
1817 } 1835 }
1818 1836
1819 // Include the auto-generated part of this file. We split this because it means 1837 // Include the auto-generated part of this file. We split this because it means
1820 // we can easily edit the non-auto generated parts right here in this file 1838 // we can easily edit the non-auto generated parts right here in this file
1821 // instead of having to edit some template or the code generator. 1839 // instead of having to edit some template or the code generator.
1822 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" 1840 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h"
1823 1841
1824 } // namespace gles2 1842 } // namespace gles2
1825 } // namespace gpu 1843 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698